mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-05-24 20:14:40 -04:00
Add decryption progress
This commit is contained in:
parent
5c5f326ae4
commit
8213612319
2 changed files with 8 additions and 10 deletions
|
@ -22,11 +22,13 @@ var (
|
||||||
decryptionError = false
|
decryptionError = false
|
||||||
)
|
)
|
||||||
|
|
||||||
func decryptContents(path string, progress *int) error {
|
func decryptContents(path string, progress *ProgressWindow) error {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
go runDecryption(path, progress)
|
progressInt := 0
|
||||||
|
go runDecryption(path, &progressInt)
|
||||||
for !decryptionDone {
|
for !decryptionDone {
|
||||||
fmt.Println(*progress)
|
progress.bar.SetFraction(float64(progressInt) / 100)
|
||||||
|
progress.percentLabel.SetText(fmt.Sprintf("Decrypting... (%d%%)", progressInt))
|
||||||
time.Sleep(500 * time.Millisecond)
|
time.Sleep(500 * time.Millisecond)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,8 +106,6 @@ func downloadFile(progressWindow *ProgressWindow, client *grab.Client, url strin
|
||||||
}
|
}
|
||||||
|
|
||||||
func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, progressWindow *ProgressWindow) error {
|
func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, progressWindow *ProgressWindow) error {
|
||||||
progress := 0
|
|
||||||
currentFile := ""
|
|
||||||
outputDir := strings.TrimRight(outputDirectory, "/\\")
|
outputDir := strings.TrimRight(outputDirectory, "/\\")
|
||||||
baseURL := fmt.Sprintf("http://ccs.cdn.c.shop.nintendowifi.net/ccs/download/%s", titleID)
|
baseURL := fmt.Sprintf("http://ccs.cdn.c.shop.nintendowifi.net/ccs/download/%s", titleID)
|
||||||
titleKeyBytes, err := hex.DecodeString(titleID)
|
titleKeyBytes, err := hex.DecodeString(titleID)
|
||||||
|
@ -196,16 +194,14 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
|
||||||
if err := binary.Read(bytes.NewReader(tmdData[offset:offset+4]), binary.BigEndian, &id); err != nil {
|
if err := binary.Read(bytes.NewReader(tmdData[offset:offset+4]), binary.BigEndian, &id); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
currentFile = fmt.Sprintf("%08X.app", id)
|
appPath := filepath.Join(outputDir, fmt.Sprintf("%08X.app", id))
|
||||||
appPath := filepath.Join(outputDir, currentFile)
|
|
||||||
downloadURL = fmt.Sprintf("%s/%08X", baseURL, id)
|
downloadURL = fmt.Sprintf("%s/%08X", baseURL, id)
|
||||||
if err := downloadFile(progressWindow, client, downloadURL, appPath); err != nil {
|
if err := downloadFile(progressWindow, client, downloadURL, appPath); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if tmdData[offset+7]&0x2 == 2 {
|
if tmdData[offset+7]&0x2 == 2 {
|
||||||
currentFile = fmt.Sprintf("%08X.h3", id)
|
h3Path := filepath.Join(outputDir, fmt.Sprintf("%08X.h3", id))
|
||||||
h3Path := filepath.Join(outputDir, currentFile)
|
|
||||||
downloadURL = fmt.Sprintf("%s/%08X.h3", baseURL, id)
|
downloadURL = fmt.Sprintf("%s/%08X.h3", baseURL, id)
|
||||||
if err := downloadFile(progressWindow, client, downloadURL, h3Path); err != nil {
|
if err := downloadFile(progressWindow, client, downloadURL, h3Path); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -221,7 +217,7 @@ func DownloadTitle(titleID string, outputDirectory string, doDecryption bool, pr
|
||||||
}
|
}
|
||||||
|
|
||||||
if doDecryption {
|
if doDecryption {
|
||||||
if err := decryptContents(outputDir, &progress); err != nil {
|
if err := decryptContents(outputDir, progressWindow); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue