MCPcopy Create free account
hub / github.com/devkitPro/3ds-hbmenu / netsenderTask

Function netsenderTask

source/ui/netsender.c:410–460  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

408}
409
410void netsenderTask(void* arg)
411{
412 wantExit = false;
413 filelen = 0;
414 filetotal = 0;
415 dsaddr.s_addr = INADDR_NONE;
416 doneSearching = false;
417 errored = false;
418
419 if (!netsenderInit())
420 {
421 errorScreen(textGetString(StrId_NetSender), textGetString(StrId_NetSenderUnavailable));
422 return;
423 }
424
425 uiEnterState(UI_STATE_NETSENDER);
426
427 dsaddr = find3DS(10);
428 if (errored || wantExit)
429 goto _cleanup;
430
431 doneSearching = true;
432 if (dsaddr.s_addr == INADDR_NONE)
433 {
434 LightEvent_Init(&event, RESET_ONESHOT);
435 LightEvent_Wait(&event);
436 LightEvent_Clear(&event);
437 }
438
439 if (wantExit || dsaddr.s_addr == INADDR_NONE)
440 goto _cleanup;
441
442 menuEntry_s* me = (menuEntry_s*)arg;
443 char* filename = strdup(me->path);
444 char* basename = strrchr(filename,'/') + 1; // assume it doesnt fail
445
446 FILE* inf = fopen(me->path, "rb");
447 fseek(inf, 0, SEEK_END);
448 filelen = ftell(inf);
449 fseek(inf, 0, SEEK_SET);
450
451 send3DSXFile(dsaddr.s_addr, basename, inf);
452
453 fclose(inf);
454 free(filename);
455
456_cleanup:
457 netsenderDeactivate();
458 if (!errored)
459 uiExitState();
460}
461
462static bool validateIp(const char* ip, size_t len)
463{

Callers

nothing calls this directly

Calls 8

netsenderInitFunction · 0.85
errorScreenFunction · 0.85
textGetStringFunction · 0.85
uiEnterStateFunction · 0.85
find3DSFunction · 0.85
send3DSXFileFunction · 0.85
netsenderDeactivateFunction · 0.85
uiExitStateFunction · 0.85

Tested by

no test coverage detected