@@ -26,6 +26,9 @@ extern "C" {
2626 pub async fn get_save ( ) -> Result < JsValue , JsValue > ;
2727 #[ wasm_bindgen( js_name = "downloadIso" , catch) ]
2828 pub async fn download_iso ( is_wii : String ) -> Result < ( ) , JsValue > ;
29+ #[ wasm_bindgen( js_name = "fetchMappings" , catch) ]
30+ pub async fn fetch_mappings ( ) -> Result < ( ) , JsValue > ;
31+ #[ cfg( not( feature = "generic_patch" ) ) ]
2932 #[ wasm_bindgen( js_name = "getMapping" ) ]
3033 pub fn get_mapping ( buf : & [ u8 ] ) -> String ;
3134}
@@ -55,6 +58,10 @@ impl Component for App {
5558 web_sys:: console:: info_1 ( & "Initializing application..." . into ( ) ) ;
5659 let progress_callback: Callback < Message > = ctx. link ( ) . callback ( |msg| msg) ;
5760 progress_callback. emit ( Message :: PatchProgress ( Some ( "Starting Application..." . into ( ) ) , None ) ) ;
61+ #[ cfg( not( feature = "generic_patch" ) ) ]
62+ wasm_bindgen_futures:: spawn_local ( async {
63+ let _ = fetch_mappings ( ) . await ;
64+ } ) ;
5865
5966 let worker_options = WorkerOptions :: new ( ) ;
6067 worker_options. set_type ( web_sys:: WorkerType :: Module ) ;
@@ -250,6 +257,7 @@ pub struct Patch {
250257pub struct PatchInputProps {
251258 pub callback : Callback < Option < Patch > > ,
252259 pub disabled : Option < bool > ,
260+ #[ cfg( not( feature = "generic_patch" ) ) ]
253261 pub version : Option < String > ,
254262}
255263
@@ -478,12 +486,20 @@ pub fn MainForm(props: &MainFormProps) -> Html {
478486 let tpgz_link = html ! {
479487 <></>
480488 } ;
489+ #[ cfg( not( feature = "generic_patch" ) ) ]
490+ let patch_input = html ! {
491+ <PatchInput callback={ patch_input_callback} disabled={ disabled} version={ selected_iso. as_ref( ) . map( |( _, version) | get_mapping( version) ) } />
492+ } ;
493+ #[ cfg( feature = "generic_patch" ) ]
494+ let patch_input = html ! {
495+ <PatchInput callback={ patch_input_callback} disabled={ disabled} />
496+ } ;
481497 html ! {
482498 <>
483499 <fieldset id="main_form" >
484500 <legend>{ "ISO Patcher" } </legend>
485501 <IsoInput callback={ iso_change_callback} disabled={ is_patching} />
486- < PatchInput callback= { patch_input_callback } disabled= { disabled } version= { selected_iso . as_ref ( ) . map ( | ( _ , version ) | get_mapping ( version ) ) } />
502+ { patch_input }
487503 <span data-tooltip="Nothing is uploaded, processing is done on your device" >{ "🛈" } </span>
488504 <button disabled={ is_patching || selected_patch. is_none( ) || selected_iso. is_none( ) } onclick={ callback} >{ "Patch" } </button>
489505 <StatusBar is_patching={ is_patching} msg={ if is_patching { status} else { None } } progress={ if is_patching { props. progress} else { None } } />
0 commit comments