mirror of
https://github.com/Xpl0itU/WiiUDownloader.git
synced 2025-06-03 16:48:43 -04:00
Rewrite cert generation and fix bad cert
This commit is contained in:
parent
ba6ff5d548
commit
f4eee481fe
4 changed files with 24 additions and 42 deletions
|
@ -2,10 +2,8 @@ package wiiudownloader
|
|||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
|
@ -211,25 +209,13 @@ func DownloadTitle(titleID, outputDirectory string, doDecryption bool, progressR
|
|||
|
||||
progressReporter.SetDownloadSize(int64(titleSize))
|
||||
|
||||
cert, err := GenerateCert(tmd, progressReporter, client)
|
||||
if err != nil {
|
||||
if err := GenerateCert(tmd, filepath.Join(outputDir, "title.cert"), progressReporter, client); err != nil {
|
||||
if progressReporter.Cancelled() {
|
||||
return nil
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
certPath := filepath.Join(outputDir, "title.cert")
|
||||
certFile, err := os.Create(certPath)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := binary.Write(certFile, binary.BigEndian, cert.Bytes()); err != nil {
|
||||
return err
|
||||
}
|
||||
certFile.Close()
|
||||
log.Printf("Certificate saved to %v \n", certPath)
|
||||
|
||||
g, ctx := errgroup.WithContext(context.Background())
|
||||
g.SetLimit(maxConcurrentDownloads)
|
||||
sem := semaphore.NewWeighted(maxConcurrentDownloads)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue