@@ -176,28 +176,10 @@ void cleanup() {
176176}
177177
178178int exit_code = 0 ;
179- int use_curl_instead = 0 ;
180- int cancel_install = 0 ;
179+ int is_sc_called = 0 ;
180+ int is_local_cia = 0 ;
181181u64 title_id = 0 ;
182-
183- void install_from_remote_done (void * data ) {
184- if (envIsHomebrew ()) {
185- char * from_3dsx_path = (char * )data ;
186- if (from_3dsx_path != NULL ) {
187- loader_launch_file (from_3dsx_path , NULL );
188- exit_code = 1 ;
189- }
190- } else if (title_id != 0 && cancel_install ) {
191- Result res = 0 ;
192-
193- if (R_SUCCEEDED (res = APT_PrepareToDoApplicationJump (0 , title_id , 1 ))) {
194- u8 param [0x300 ];
195- u8 hmac [0x20 ];
196-
197- APT_DoApplicationJump (param , sizeof (param ), hmac );
198- }
199- }
200- }
182+ char * sc_3dsx_path = NULL ;
201183
202184static bool remoteinstall_get_urls_by_path (const char * path , char * out , size_t size ) {
203185 if (out == NULL || size == 0 ) {
@@ -230,17 +212,23 @@ int main(int argc, const char* argv[]) {
230212 // Install from URL if a URL was passed as an argument.
231213 if (envIsHomebrew ()) {
232214 if (argc > 2 ) {
233- use_curl_instead = 1 ;
215+ is_sc_called = 1 ;
234216 char * url = (char * ) calloc (1 , DOWNLOAD_URL_MAX * INSTALL_URLS_MAX );
235217 remoteinstall_get_urls_by_path (argv [1 ], url , DOWNLOAD_URL_MAX * INSTALL_URLS_MAX );
236- action_install_url ("Install From URL?" ,
218+ sc_3dsx_path = (char * )argv [2 ];
219+ if (strncmp (url , "/" , 1 ) == 0 ) {
220+ is_local_cia = 1 ;
221+ action_install_cia_by_path (url );
222+ } else {
223+ action_install_url ("Install From URL?" ,
237224 url ,
238225 fs_get_3dsx_path (),
239- (void * )argv [2 ],
240226 NULL ,
241- install_from_remote_done ,
227+ NULL ,
228+ install_from_sc_done ,
242229 NULL
243- );
230+ );
231+ }
244232 free (url );
245233 }
246234 } else {
@@ -259,18 +247,24 @@ int main(int argc, const char* argv[]) {
259247 if (len > 0 ) {
260248 char * params_str = (char * )param ;
261249 if (strncmp (params_str , "sc:" , 3 ) == 0 ) {
262- use_curl_instead = 1 ;
250+ is_sc_called = 1 ;
263251 char * path = params_str + 3 ;
264252 char * url = (char * ) calloc (1 , DOWNLOAD_URL_MAX * INSTALL_URLS_MAX );
265253 remoteinstall_get_urls_by_path (path , url , DOWNLOAD_URL_MAX * INSTALL_URLS_MAX );
266- action_install_url ("Install From URL?" ,
254+ // file path
255+ if (strncmp (url , "/" , 1 ) == 0 ) {
256+ is_local_cia = 1 ;
257+ action_install_cia_by_path (url );
258+ } else {
259+ action_install_url ("Install From URL?" ,
267260 url ,
268261 fs_get_3dsx_path (),
269262 NULL ,
270263 NULL ,
271- install_from_remote_done ,
264+ install_from_sc_done ,
272265 NULL
273- );
266+ );
267+ }
274268 free (url );
275269 }
276270 }
0 commit comments