Created
July 22, 2018 12:28
-
-
Save hax0kartik/d34de273cd90be70bbbb2124ba5139e0 to your computer and use it in GitHub Desktop.
FRD service example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <stdlib.h> | |
#include <3ds.h> | |
int main() | |
{ | |
gfxInitDefault(); // Init graphic stuff | |
consoleInit(GFX_TOP, NULL); | |
printf("FRD_Init() %08lX\n", frdInit()); | |
Result ret = 0; | |
Handle event; | |
bool state; | |
printf("FRD_LogOut %08lx\n", FRD_Logout()); | |
printf("FrdLogin() %08lX\n", FRD_Login(&event)); | |
printf("Waiting on Handle..."); | |
svcWaitSynchronization(event, U64_MAX); | |
printf("Wait done.\n"); | |
printf("FRD_HasLoggedIn %08lx\n", FRDU_HasLoggedIn(&state)); | |
printf("Logged In: %d\n", state); | |
FriendKey key[1]; | |
u64 friend_code; | |
size_t num; | |
printf("FRD_GetFriendKeyList %08lX\n", FRD_GetFriendKeyList(key, &num, 0, 1)); | |
printf("PrincipalID : %lX : %lld\n", key[0].principalId, key[0].localFriendCode); | |
printf("FRD_PrincipalIdToFriendCode() %08lX\n", FRD_PrincipalIdToFriendCode(key[0].principalId, &friend_code)); | |
printf("FRD_IsValidFriendCode %08lx\n", FRD_IsValidFriendCode(friend_code, &state)); | |
printf("Valid : %d\n", state); | |
printf("FRD_COnvertFriendCodeToPrincipalId %08lx\n", FRD_FriendCodeToPrincipalId(friend_code, &key[0].principalId)); | |
printf("PrincipalID : %lX : %lld\n", key[0].principalId, friend_code); | |
Profile profile; | |
printf("FRD_GetFriendProfile %08lx\n", FRD_GetFriendProfile(&profile, key, 1)); | |
printf("region %d, country %d, language %d\n", profile.region, profile.country, profile.language); | |
MiiData mii; | |
printf("FRD_GetFriendMii %08lx\n", FRD_GetFriendMii(&mii, key, 1)); | |
printf("mii_id : %ld\n", mii.mii_id); | |
GameDescription desc; | |
printf("FRD_GetFriendFavouriteGame %08lX\n", FRD_GetFriendFavouriteGame(&desc, key, 1)); | |
printf("Game TID %llX", desc.data.tid); | |
/* | |
u8 screenName[FRIENDS_SCREEN_NAME_SIZE]; | |
u8 comment[FRIENDS_COMMENT_SIZE]; | |
printf("FRD_GetMyScreenName %08lx\n", FRD_GetMyScreenName(screenName)); | |
printf("FRD_GetMyComment %08lx\n", FRD_GetMyComment(comment)); | |
printf("FRD_UpdateGAmeModeDesc %08lx\n", FRD_UpdateGameModeDescription(comment)); | |
for(int i = 0; i <= 14; i++) | |
{ | |
printf("SreenName %X %c\n", screenName[i], screenName[i]); | |
} | |
printf(L"Collected %s", screenName); | |
printf("Printed"); | |
u8 buf[300]; | |
size_t size = utf16_to_utf8((uint8_t*)buf, (uint16_t*)screenName, FRIENDS_SCREEN_NAME_SIZE); | |
buf[size] = '\0'; | |
printf("SreenName %s\n", screenName); | |
printf("COmment %s", comment); | |
*/ | |
// Loop as long as the status is not exit | |
while(aptMainLoop()) | |
{ | |
// Scan hid shared memory for input events | |
hidScanInput(); | |
if(hidKeysDown() & KEY_START) // If the A button got pressed, start the app launch | |
{ | |
break; | |
} | |
// Flush + swap framebuffers and wait for VBlank. Not really needed in this example | |
gfxFlushBuffers(); | |
gfxSwapBuffers(); | |
gspWaitForVBlank(); | |
} | |
gfxExit(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment