@@ -232,7 +232,7 @@ pub fn register_listeners(app: &AppHandle) {
232232 prevent_exit ( & h4, false ) ;
233233 send_notification ( & h4, format ! ( "Download of {inn} complete." , inn = install. name) . as_str ( ) , None ) ;
234234 }
235- // KuroGame only currently
235+ // KuroGame only
236236 "DOWNLOAD_MODE_RAW" => {
237237 let urls = picked. game . full . iter ( ) . map ( |v| v. file_url . clone ( ) ) . collect :: < Vec < String > > ( ) ;
238238 let manifest = urls. get ( 0 ) . unwrap ( ) ;
@@ -261,7 +261,7 @@ pub fn register_listeners(app: &AppHandle) {
261261 }
262262 }
263263 }
264- // Fallback mode... NOT IMPLEMENTED AS I DID NOT WRITE ANY IN THE LIBRARY
264+ // Fallback mode
265265 _ => { }
266266 }
267267 } else {
@@ -378,7 +378,7 @@ pub fn register_listeners(app: &AppHandle) {
378378 }
379379 }
380380 }
381- // Fallback mode... NOT IMPLEMENTED AS I DID NOT WRITE ANY IN THE LIBRARY
381+ // Fallback mode
382382 _ => { }
383383 }
384384 } else {
@@ -476,7 +476,6 @@ pub fn register_listeners(app: &AppHandle) {
476476 let dlpayload = dlpayload. clone ( ) ;
477477 move |current, total| {
478478 let mut dlp = dlpayload. lock ( ) . unwrap ( ) ;
479-
480479 dlp. insert ( "name" , instn. to_string ( ) ) ;
481480 dlp. insert ( "progress" , current. to_string ( ) ) ;
482481 dlp. insert ( "total" , total. to_string ( ) ) ;
@@ -535,7 +534,7 @@ pub fn register_listeners(app: &AppHandle) {
535534 prevent_exit ( & h5, true ) ;
536535
537536 match pmd. download_mode . as_str ( ) {
538- // Generic zipped mode, Variety per game can not account for every case yet
537+ // Generic zipped mode, Variety per game
539538 "DOWNLOAD_MODE_FILE" => {
540539 h5. emit ( "preload_complete" , ( ) ) . unwrap ( ) ;
541540 prevent_exit ( & h5, false ) ;
@@ -611,7 +610,7 @@ pub fn register_listeners(app: &AppHandle) {
611610 }
612611 }*/
613612 }
614- // Fallback mode... NOT IMPLEMENTED AS I DID NOT WRITE ANY IN THE LIBRARY
613+ // Fallback mode
615614 _ => { }
616615 }
617616 }
@@ -785,14 +784,14 @@ pub fn download_or_update_jadeite(path: PathBuf, update_mode: bool) {
785784 if update_mode {
786785 if fs:: read_dir ( & path) . unwrap ( ) . next ( ) . is_some ( ) {
787786 std:: thread:: spawn ( move || {
788- let dl = Extras :: download_jadeite ( "MrLGamer/jadeite" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) ) ;
787+ let dl = Extras :: download_jadeite ( "MrLGamer/jadeite" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , move |_current , _total| { } ) ;
789788 if dl { extract_archive ( "" . to_string ( ) , path. join ( "jadeite.zip" ) . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , false ) ; }
790789 } ) ;
791790 }
792791 } else {
793792 if fs:: read_dir ( & path) . unwrap ( ) . next ( ) . is_none ( ) {
794793 std:: thread:: spawn ( move || {
795- let dl = Extras :: download_jadeite ( "MrLGamer/jadeite" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) ) ;
794+ let dl = Extras :: download_jadeite ( "MrLGamer/jadeite" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , move |_current , _total| { } ) ;
796795 if dl { extract_archive ( "" . to_string ( ) , path. join ( "jadeite.zip" ) . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , false ) ; }
797796 } ) ;
798797 }
@@ -802,11 +801,11 @@ pub fn download_or_update_jadeite(path: PathBuf, update_mode: bool) {
802801pub fn download_or_update_fps_unlock ( path : PathBuf , update_mode : bool ) {
803802 if update_mode {
804803 if fs:: read_dir ( & path) . unwrap ( ) . next ( ) . is_some ( ) {
805- std:: thread:: spawn ( move || { Extras :: download_fps_unlock ( "TwintailTeam/KeqingUnlock" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) ) ; } ) ;
804+ std:: thread:: spawn ( move || { Extras :: download_fps_unlock ( "TwintailTeam/KeqingUnlock" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , move |_current , _total| { } ) ; } ) ;
806805 }
807806 } else {
808807 if fs:: read_dir ( & path) . unwrap ( ) . next ( ) . is_none ( ) {
809- std:: thread:: spawn ( move || { Extras :: download_fps_unlock ( "TwintailTeam/KeqingUnlock" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) ) ; } ) ;
808+ std:: thread:: spawn ( move || { Extras :: download_fps_unlock ( "TwintailTeam/KeqingUnlock" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , move |_current , _total| { } ) ; } ) ;
810809 }
811810 }
812811}
@@ -815,7 +814,7 @@ pub fn download_or_update_xxmi(app: &AppHandle, path: PathBuf, update_mode: bool
815814 if update_mode {
816815 if fs:: read_dir ( & path) . unwrap ( ) . next ( ) . is_some ( ) {
817816 std:: thread:: spawn ( move || {
818- let dl = Extras :: download_xxmi ( "SpectrumQT/XXMI-Libs-Package" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , false ) ;
817+ let dl = Extras :: download_xxmi ( "SpectrumQT/XXMI-Libs-Package" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , false , move |_current , _total| { } ) ;
819818 if dl {
820819 extract_archive ( "" . to_string ( ) , path. join ( "xxmi.zip" ) . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , false ) ;
821820 let gimi = String :: from ( "SilentNightSound/GIMI-Package" ) ;
@@ -849,11 +848,21 @@ pub fn download_or_update_xxmi(app: &AppHandle, path: PathBuf, update_mode: bool
849848 let app = app. clone ( ) ;
850849 let mut dlpayload = HashMap :: new ( ) ;
851850 dlpayload. insert ( "name" , String :: from ( "XXMI Modding tool" ) ) ;
852- dlpayload. insert ( "progress" , "80 " . to_string ( ) ) ;
853- dlpayload. insert ( "total" , "100 " . to_string ( ) ) ;
851+ dlpayload. insert ( "progress" , "0 " . to_string ( ) ) ;
852+ dlpayload. insert ( "total" , "1000 " . to_string ( ) ) ;
854853 app. emit ( "download_progress" , dlpayload. clone ( ) ) . unwrap ( ) ;
855854 prevent_exit ( & app, true ) ;
856- let dl = Extras :: download_xxmi ( "SpectrumQT/XXMI-Libs-Package" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , true ) ;
855+ let dl = Extras :: download_xxmi ( "SpectrumQT/XXMI-Libs-Package" . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , true , {
856+ let app = app. clone ( ) ;
857+ let dlpayload = dlpayload. clone ( ) ;
858+ move |current, total| {
859+ let mut dlpayload = dlpayload. clone ( ) ;
860+ dlpayload. insert ( "name" , "XXMI Modding tool" . to_string ( ) ) ;
861+ dlpayload. insert ( "progress" , current. to_string ( ) ) ;
862+ dlpayload. insert ( "total" , total. to_string ( ) ) ;
863+ app. emit ( "download_progress" , dlpayload. clone ( ) ) . unwrap ( ) ;
864+ }
865+ } ) ;
857866 if dl {
858867 extract_archive ( "" . to_string ( ) , path. join ( "xxmi.zip" ) . as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , path. as_path ( ) . to_str ( ) . unwrap ( ) . parse ( ) . unwrap ( ) , false ) ;
859868 let gimi = String :: from ( "SilentNightSound/GIMI-Package" ) ;
0 commit comments