1- #include <3ds/types.h>
2- #include <3ds/result.h>
3- #include <3ds/svc.h>
4- #include <3ds/srv.h>
5- #include <3ds/synchronization.h>
6- #include <3ds/services/cfgu.h>
7- #include <3ds/services/ndm.h>
8- #include <3ds/ipc.h>
9-
1+ /**
2+ * @file dlpclnt.h
3+ * @brief dlp::clnt (download play client) service.
4+ */
5+ #pragma once
6+
7+ /// Download play client state.
8+ typedef enum {
9+ DLPCLNT_STATE_IDLE = 1 ,
10+ DLPCLNT_STATE_SCANNING = 2 ,
11+ DLPCLNT_STATE_JOINED = 5 ,
12+ DLPCLNT_STATE_DOWNLOADING = 6 ,
13+ DLPCLNT_STATE_COMPLETE = 9
14+ } dlpClntState ;
15+
16+ /// Info about a scanned title
1017typedef struct {
1118 u32 uniqueId ;
12- u32 revision ;
19+ u32 variation ;
1320 u8 macAddr [6 ];
14- } dlpTitleInfo ;
21+ u16 version ; // XX: probably?
22+ u8 ageRatings [16 ];
23+ u16 shortDescription [64 ]; // UTF-16
24+ u16 longDescription [128 ]; // UTF-16
25+ u8 icon [0x1200 ]; // 48x48, RGB565
26+ u32 size ;
27+ u8 unknown2 ;
28+ u8 unknown3 ;
29+ u16 padding ;
30+ } dlpClntTitleInfo ;
31+
32+ /// Information about dlp client's status.
33+ typedef struct {
34+ dlpClntState state ;
35+ u32 unitsTotal ;
36+ u32 unitsRecvd ;
37+ } dlpClntMyStatus ;
1538
39+ /// Initializes DLP client.
1640Result dlpClntInit (void );
1741
42+ /// Exits DLP client.
1843void dlpClntExit (void );
1944
45+ /**
46+ * @brief Waits for the dlp event to occur, or checks if the event was signaled.
47+ * @return Always true. However if wait=false, this will return false if the event wasn't signaled.
48+ * @param nextEvent Whether to discard the current event and wait for the next event.
49+ * @param wait When true this will not return until the event is signaled. When false this checks if the event was signaled without waiting for it.
50+ */
2051bool dlpClntWaitForEvent (bool nextEvent , bool wait );
2152
22- u64 dlpCreateChildTid (u32 uniqueId , u32 revision );
53+ /**
54+ * @brief Calculates the aligned shared memory size to use with dlp.
55+ * @return The calculated aligned memory size to use.
56+ * @param maxTitles Maximum amount of titles that can be found in a scan at once. Cannot be larger than 16.
57+ * @param constantMemSize Must be between 0x100000 and 0x200000.
58+ */
59+ size_t dlpCalcSharedMemSize (u8 maxTitles , size_t constantMemSize );
2360
24- Result DLPCLNT_Initialize (size_t sharedMemSize , u8 maxScanTitles , size_t unk , Handle sharedmemHandle , Handle eventHandle );
61+ /**
62+ * @brief Forms the title id of a title's dlp child.
63+ * @return The dlp child title id.
64+ * @param uniqueId The title's unique id.
65+ * @param variation The title's variation.
66+ */
67+ u64 dlpCreateChildTid (u32 uniqueId , u32 variation );
68+
69+ /**
70+ * @brief Initializes dlp clnt.
71+ * @param sharedMemSize Size of the shared memory.
72+ * @param maxScanTitles Maximum amount of titles that can be found in a scan at once. Cannot be larger than 16.
73+ * @param constantMemSize Must be between 0x100000 and 0x200000.
74+ * @param sharedMemHandle Shared memory handle.
75+ * @param eventHandle Event handle that will be signaled by dlp clnt.
76+ */
77+ Result DLPCLNT_Initialize (size_t sharedMemSize , u8 maxScanTitles , size_t constantMemSize , Handle sharedmemHandle , Handle eventHandle );
2578
79+ /// Finalizes dlp clnt.
2680Result DLPCLNT_Finalize (void );
2781
28- //DLPCLNT_GetEventDesc();
29-
82+ /**
83+ * @brief Gets channel.
84+ * @paramt channel Pointer to output channel to.
85+ */
3086Result DLPCLNT_GetChannel (u16 * channel );
3187
32- Result DLPCLNT_StartScan (u16 channel , u8 * macAddr );
88+ /**
89+ * @brief Begin scanning for dlp servers.
90+ * @param channel Channel to use.
91+ * @param macAddr Optional mac address to filter detected dlp servers. Must be 6 bytes.
92+ * @param tidFilter If not 0, filters detected dlp child titles to specified title id.
93+ */
94+ Result DLPCLNT_StartScan (u16 channel , u8 * macAddrFilter , u64 tidFilter );
3395
96+ /// Stop scanning for dlp servers.
3497Result DLPCLNT_StopScan (void );
35- /*
36- DLPCLNT_GetServerInfo();
3798
38- DLPCLNT_GetTitleInfo();
99+ /**
100+ * @brief Get title info from scan.
101+ * @param titleInfo Pointer to write title info to.
102+ * @param actual_size Optional pointer to output actual title size written.
103+ * @param macAddr Mac address of server. Must be 6 bytes.
104+ * @param uniqueId Unique id of title.
105+ * @param variation Variation of title.
39106*/
40- Result DLPCLNT_GetTitleInfoInOrder (void * buf , size_t size , size_t * actual_size );
41- /*
42- DLPCLNT_DeleteScanInfo();
107+ Result DLPCLNT_GetTitleInfo (dlpClntTitleInfo * titleInfo , size_t * actual_size , u8 * macAddr , u32 uniqueId , u32 variation );
108+
109+ /**
110+ * @brief Get available title info from scan, getting the next available title info on the next call.
111+ * @param titleInfo Pointer to write title info to.
112+ * @param actual_size Optional pointer to output actual title size written to buffer.
43113*/
44- Result DLPCLNT_PrepareForSystemDownload (u8 * macAddr , u32 uniqueId , u32 revision );
45- /*
46- DLPCLNT_StartSystemDownload();
114+ Result DLPCLNT_GetTitleInfoInOrder (dlpClntTitleInfo * titleInfo , size_t * actual_size );
115+
116+ /**
117+ * @brief Prepares for system download for system update.
118+ * @param macAddr Mac address of server to download from. Must be 6 bytes.
119+ * @param uniqueId Unique id of title advertised by server.
120+ * @param variation Variation of title advertised by server.
47121*/
48- Result DLPCLNT_StartTitleDownload (u8 * macAddr , u32 uniqueId , u32 revision );
122+ Result DLPCLNT_PrepareForSystemDownload (u8 * macAddr , u32 uniqueId , u32 variation );
49123
50- Result DLPCLNT_GetMyStatus (u32 * status );
51- /*
52- DLPCLNT_GetConnectingNodes();
124+ /// Joins dlp session and waits for server to begin distributing system update.
125+ Result DLPCLNT_StartSystemDownload (void );
126+
127+ /**
128+ * @brief Joins dlp session and waits for server to begin distributing dlp child.
129+ * @param macAddr Mac address of server to join and download from. Must be 6 bytes.
130+ * @param uniqueId Unique id of title advertised by server.
131+ * @param variation Variation of title advertised by server.
132+ */
133+ Result DLPCLNT_StartTitleDownload (u8 * macAddr , u32 uniqueId , u32 variation );
53134
54- DLPCLNT_GetNodeInfo();
135+ /**
136+ * @brief Gets dlp status information.
137+ * @param status Status pointer to output to.
138+ */
139+ Result DLPCLNT_GetMyStatus (dlpClntMyStatus * status );
140+
141+ /**
142+ * @brief Gets dlp wireless reboot passphrase.
143+ * @param buf Buffer to write reboot passphrase to. Must be 9 bytes.
55144*/
56145Result DLPCLNT_GetWirelessRebootPassphrase (void * buf );
57146
147+ /// Disconnects from dlp server.
58148Result DLPCLNT_StopSession (void );
59- /*
60- DLPCLNT_GetCupVersion();
61-
62- DLPCLNT_GetDupAvailability();*/
0 commit comments