UPDATE: Fix bug
This commit is contained in:
@@ -68,9 +68,11 @@ func (h *DiffService) VersionValidate(gamePath, patchPath string) (bool, string)
|
||||
if err := sevenzip.ExtractAFileFromZip(patchPath, "StarRail_Data\\StreamingAssets\\BinaryVersion.bytes.hdiff", constant.TempUrl); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
|
||||
patchBinFile := filepath.Join(constant.TempUrl, "BinaryVersion.bytes.hdiff")
|
||||
sourceBinFile := oldBinPath
|
||||
tempBinFile = filepath.Join(constant.TempUrl, "BinaryVersion.bytes")
|
||||
|
||||
if err := hpatchz.ApplyPatch(sourceBinFile, patchBinFile, tempBinFile); err != nil {
|
||||
os.Remove(patchBinFile)
|
||||
return false, err.Error()
|
||||
@@ -172,9 +174,11 @@ func (h *DiffService) HDiffPatchData(gamePath string) (bool, string) {
|
||||
if err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
if err := json.Unmarshal(data, &jsonData); err != nil {
|
||||
var hdiffJson []*models.HDiffData
|
||||
if err := json.Unmarshal(data, &hdiffJson); err != nil {
|
||||
return false, err.Error()
|
||||
}
|
||||
jsonData.DiffMap = append(jsonData.DiffMap, hdiffJson...)
|
||||
} else if _, err := os.Stat(hdiffFilesPath); err == nil {
|
||||
files, err := models.LoadHDiffFiles(hdiffFilesPath)
|
||||
if err != nil {
|
||||
@@ -188,6 +192,7 @@ func (h *DiffService) HDiffPatchData(gamePath string) (bool, string) {
|
||||
}
|
||||
|
||||
application.Get().Event.Emit("diff:stage", map[string]string{"stage": "Patching HDiff"})
|
||||
|
||||
for i, entry := range jsonData.DiffMap {
|
||||
application.Get().Event.Emit(
|
||||
"diff:progress", map[string]int{
|
||||
|
||||
Reference in New Issue
Block a user