@@ -27,7 +27,7 @@ static class G
27
27
static public readonly string makeNpdata = currentDir + "\\ make_npdata.exe" ;
28
28
static public readonly string patchPath = currentDir + "\\ patch" ;
29
29
static public readonly string DECPath = patchPath + "\\ decrypted.data" ;
30
- static public readonly string version = "5 " ;
30
+ static public readonly string version = "6 " ;
31
31
static public readonly WebClient wc = new WebClient ( ) ;
32
32
static public void Exit ( string msg )
33
33
{
@@ -390,7 +390,7 @@ public ProcessArgs(bool exitAfterPatch, string input)
390
390
psnID . Append ( regionID ) ;
391
391
psnID . Append ( lowID == "BL" ? "B" : "A" ) ;
392
392
newID = psnID . ToString ( ) + highID ;
393
- Console . Write ( "Game identified: " ) ;
393
+ Console . Write ( "\n Game identified: " ) ;
394
394
Program . Cyan ( ID + "\n " ) ;
395
395
if ( ! exitAfterPatch )
396
396
{
@@ -549,7 +549,7 @@ static void Updates(string ID)
549
549
{
550
550
try
551
551
{
552
- G . xmlDoc . LoadXml ( G . wc . DownloadString ( new Uri ( "https://a0.ww.np.dl.playstation.net/tpl/np/" + ID + "/" + ID + "-ver.xml" ) ) ) ;
552
+ G . xmlDoc . LoadXml ( G . wc . DownloadString ( "https://a0.ww.np.dl.playstation.net/tpl/np/" + ID + "/" + ID + "-ver.xml" ) ) ;
553
553
}
554
554
catch ( WebException e )
555
555
{
@@ -599,13 +599,19 @@ static void GetPatch(KeyValuePair<string, string> entry, string part)
599
599
fname = url . Substring ( url . LastIndexOf ( "/" , StringComparison . Ordinal ) + 1 ) ,
600
600
path = G . patchPath + "\\ " + fname ;
601
601
bool exists = File . Exists ( path ) ;
602
- Console . Write ( fname + " ..." ) ;
603
- string message = " local" ;
602
+ Console . Write ( fname + " ... " ) ;
603
+ string message = "local" ;
604
604
if ( ( exists && GetSHA1 ( path ) != entry . Value ) || ! exists )
605
605
{
606
606
if ( exists ) File . Delete ( path ) ;
607
- G . wc . DownloadFile ( url , part ) ;
608
- message = " done" ;
607
+ G . wc . DownloadProgressChanged += Wc_DownloadProgressChanged ;
608
+ G . wc . DownloadFileAsync ( new Uri ( url ) , part ) ;
609
+ while ( G . wc . IsBusy )
610
+ {
611
+ new System . Threading . ManualResetEvent ( false ) . WaitOne ( 200 ) ;
612
+ }
613
+ G . wc . DownloadProgressChanged -= Wc_DownloadProgressChanged ;
614
+ message = "done" ;
609
615
}
610
616
if ( File . Exists ( part ) ) File . Move ( part , path ) ;
611
617
G . patchFNames . Enqueue ( fname ) ;
@@ -642,6 +648,13 @@ static void GetPatches(string gameName, uint size)
642
648
G . Exit ( "Not all patches were downloaded, please try again" ) ;
643
649
}
644
650
651
+ private static void Wc_DownloadProgressChanged ( object sender , DownloadProgressChangedEventArgs e )
652
+ {
653
+ int p = e . ProgressPercentage ;
654
+ p = p < 100 ? p : 99 ;
655
+ Console . Write ( "{0:00}%\b \b \b " , p ) ;
656
+ }
657
+
645
658
static void ProcessPatches ( string outputDir , string ID )
646
659
{
647
660
string d = " done" , f = " failed\n " ;
@@ -959,6 +972,11 @@ static public void Cyan(string msg)
959
972
960
973
static void Help ( )
961
974
{
975
+ Console . WriteLine ( "Credits:" ) ;
976
+ Cyan ( "mathieulh" ) ;
977
+ Console . Write ( " - PKG code\n " ) ;
978
+ Cyan ( "Hykem" ) ;
979
+ Console . WriteLine ( " - make-mpdata\n " ) ;
962
980
Console . Write ( "To convert a game, please place the " ) ;
963
981
Green ( "PS3_GAME" ) ;
964
982
Console . Write ( " folder next to this program and run it with no arguments.\n \n " +
@@ -1002,9 +1020,10 @@ static void Main(string[] args)
1002
1020
WebRequest . DefaultWebProxy = null ;
1003
1021
G . wc . Proxy = null ;
1004
1022
CheckUpdate ( ) ;
1005
- KeyValuePair < int , int > catOffset , verOffset = new KeyValuePair < int , int > ( ) ;
1023
+ var catOffset = new KeyValuePair < int , int > ( ) ;
1024
+ var verOffset = new KeyValuePair < int , int > ( ) ;
1006
1025
1007
- Console . WriteLine ( $ " --- CFW2OFW Helper v{ G . version } ---\n Thanks to mathieulh for PKG related code! \n ") ;
1026
+ Console . WriteLine ( $ " --- CFW2OFW Helper v{ G . version } ---") ;
1008
1027
switch ( args . Length )
1009
1028
{
1010
1029
case 0 :
0 commit comments