Online: sockets and Pretendo Network

soc:U (src/3ds/services/soc.c) is the console's BSD sockets on the emulated network stack (src/common/network/net.h), its wire Azahar's soc_u.cpp's and libctru's: the console's sockaddr, pollfd, addrinfo and hostent, and its errno numbers. Host sockets never block: a call that would block a socket the game left blocking parks its thread, and the scheduler's pass answers it once the socket is ready or a poll's time is out, while the game's other threads run. Offline (network=0 or airplane mode) a socket reaches loopback alone. Names go through Pretendo's NAT check rewrite with ctr_online=pretendo, and the console maker's own domains resolve to nothing.

ac:u says the console is connected to the internet when it is online, and not connected otherwise: ConnectAsync signals its event either way, and GetConnectResult gives Azahar's not-connected result offline.

frd:u logs a game in to its server as a console with Pretendo's Nimbus does: the console's own account read from ctr_console (its files laid out as Azahar's NAND folder: rw/sys/LocalFriendCodeSeed_B, rw/sys/SecureInfo_A, and the friends save's local account 2, the one Nimbus makes), RequestGameAuthentication posts NASC's LOGIN form to Pretendo's NASC (ctr_nasc_url for another) on a thread of its own and signals the game's event when the answer came, and GetGameAuthenticationData gives the game server's address, port and token. A login that cannot go out says why once and gives NASC's result 0. The NASC form and reply, the console's files and Nimbus's rewrites are src/common/online's (its README.md). Not done yet: http:C and ssl:C (a game's own HTTPS, which Nimbus rewrites to pretendo.cc), the friends server itself (presence and the friend list), and the NCCH's product and maker codes in the form, which Pretendo's NASC does not read.


Made from docs/platforms/3ds/README.md at 69237645142c. GPL-3.0-or-later.