summaryrefslogtreecommitdiff
path: root/src/core/hle/service/frd
diff options
context:
space:
mode:
authorGravatar bunnei2017-10-10 17:32:14 -0400
committerGravatar bunnei2017-10-10 17:32:14 -0400
commit0906de9a14b735d1d409290ca050eb7d2c2d3d84 (patch)
tree79bb57d3a4dc4ca377e7a62744c3941de29e785b /src/core/hle/service/frd
parentMerge remote-tracking branch 'upstream/master' into nx (diff)
downloadyuzu-0906de9a14b735d1d409290ca050eb7d2c2d3d84.tar.gz
yuzu-0906de9a14b735d1d409290ca050eb7d2c2d3d84.tar.xz
yuzu-0906de9a14b735d1d409290ca050eb7d2c2d3d84.zip
hle: Remove a large amount of 3ds-specific service code.
Diffstat (limited to 'src/core/hle/service/frd')
-rw-r--r--src/core/hle/service/frd/frd.cpp174
-rw-r--r--src/core/hle/service/frd/frd.h127
-rw-r--r--src/core/hle/service/frd/frd_a.cpp18
-rw-r--r--src/core/hle/service/frd/frd_a.h22
-rw-r--r--src/core/hle/service/frd/frd_u.cpp72
-rw-r--r--src/core/hle/service/frd/frd_u.h22
6 files changed, 0 insertions, 435 deletions
diff --git a/src/core/hle/service/frd/frd.cpp b/src/core/hle/service/frd/frd.cpp
deleted file mode 100644
index 7ad7798da..000000000
--- a/src/core/hle/service/frd/frd.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "common/assert.h"
6#include "common/logging/log.h"
7#include "common/string_util.h"
8#include "core/hle/ipc.h"
9#include "core/hle/ipc_helpers.h"
10#include "core/hle/result.h"
11#include "core/hle/service/frd/frd.h"
12#include "core/hle/service/frd/frd_a.h"
13#include "core/hle/service/frd/frd_u.h"
14#include "core/hle/service/service.h"
15#include "core/memory.h"
16
17namespace Service {
18namespace FRD {
19
20static FriendKey my_friend_key = {0, 0, 0ull};
21static MyPresence my_presence = {};
22
23void GetMyPresence(Service::Interface* self) {
24 u32* cmd_buff = Kernel::GetCommandBuffer();
25
26 u32 shifted_out_size = cmd_buff[64];
27 u32 my_presence_addr = cmd_buff[65];
28
29 ASSERT(shifted_out_size == ((sizeof(MyPresence) << 14) | 2));
30
31 Memory::WriteBlock(my_presence_addr, &my_presence, sizeof(MyPresence));
32
33 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
34
35 LOG_WARNING(Service_FRD, "(STUBBED) called");
36}
37
38void GetFriendKeyList(Service::Interface* self) {
39 u32* cmd_buff = Kernel::GetCommandBuffer();
40
41 u32 unknown = cmd_buff[1];
42 u32 frd_count = cmd_buff[2];
43 u32 frd_key_addr = cmd_buff[65];
44
45 FriendKey zero_key = {};
46 for (u32 i = 0; i < frd_count; ++i) {
47 Memory::WriteBlock(frd_key_addr + i * sizeof(FriendKey), &zero_key, sizeof(FriendKey));
48 }
49
50 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
51 cmd_buff[2] = 0; // 0 friends
52 LOG_WARNING(Service_FRD, "(STUBBED) called, unknown=%d, frd_count=%d, frd_key_addr=0x%08X",
53 unknown, frd_count, frd_key_addr);
54}
55
56void GetFriendProfile(Service::Interface* self) {
57 u32* cmd_buff = Kernel::GetCommandBuffer();
58
59 u32 count = cmd_buff[1];
60 u32 frd_key_addr = cmd_buff[3];
61 u32 profiles_addr = cmd_buff[65];
62
63 Profile zero_profile = {};
64 for (u32 i = 0; i < count; ++i) {
65 Memory::WriteBlock(profiles_addr + i * sizeof(Profile), &zero_profile, sizeof(Profile));
66 }
67
68 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
69 LOG_WARNING(Service_FRD,
70 "(STUBBED) called, count=%d, frd_key_addr=0x%08X, profiles_addr=0x%08X", count,
71 frd_key_addr, profiles_addr);
72}
73
74void GetFriendAttributeFlags(Service::Interface* self) {
75 u32* cmd_buff = Kernel::GetCommandBuffer();
76
77 u32 count = cmd_buff[1];
78 u32 frd_key_addr = cmd_buff[3];
79 u32 attr_flags_addr = cmd_buff[65];
80
81 for (u32 i = 0; i < count; ++i) {
82 // TODO:(mailwl) figure out AttributeFlag size and zero all buffer. Assume 1 byte
83 Memory::Write8(attr_flags_addr + i, 0);
84 }
85
86 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
87 LOG_WARNING(Service_FRD,
88 "(STUBBED) called, count=%d, frd_key_addr=0x%08X, attr_flags_addr=0x%08X", count,
89 frd_key_addr, attr_flags_addr);
90}
91
92void GetMyFriendKey(Service::Interface* self) {
93 u32* cmd_buff = Kernel::GetCommandBuffer();
94
95 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
96 std::memcpy(&cmd_buff[2], &my_friend_key, sizeof(FriendKey));
97 LOG_WARNING(Service_FRD, "(STUBBED) called");
98}
99
100void GetMyScreenName(Service::Interface* self) {
101 u32* cmd_buff = Kernel::GetCommandBuffer();
102
103 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
104 // TODO: (mailwl) get the name from config
105 Common::UTF8ToUTF16("Citra").copy(reinterpret_cast<char16_t*>(&cmd_buff[2]), 11);
106 LOG_WARNING(Service_FRD, "(STUBBED) called");
107}
108
109void UnscrambleLocalFriendCode(Service::Interface* self) {
110 const size_t scrambled_friend_code_size = 12;
111 const size_t friend_code_size = 8;
112
113 IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1C, 1, 2);
114 const u32 friend_code_count = rp.Pop<u32>();
115 size_t in_buffer_size;
116 const VAddr scrambled_friend_codes = rp.PopStaticBuffer(&in_buffer_size, false);
117 ASSERT_MSG(in_buffer_size == (friend_code_count * scrambled_friend_code_size),
118 "Wrong input buffer size");
119
120 size_t out_buffer_size;
121 VAddr unscrambled_friend_codes = rp.PeekStaticBuffer(0, &out_buffer_size);
122 ASSERT_MSG(out_buffer_size == (friend_code_count * friend_code_size),
123 "Wrong output buffer size");
124
125 for (u32 current = 0; current < friend_code_count; ++current) {
126 // TODO(B3N30): Unscramble the codes and compare them against the friend list
127 // Only write 0 if the code isn't in friend list, otherwise write the
128 // unscrambled one
129 //
130 // Code for unscrambling (should be compared to HW):
131 // std::array<u16, 6> scambled_friend_code;
132 // Memory::ReadBlock(scrambled_friend_codes+(current*scrambled_friend_code_size),
133 // scambled_friend_code.data(), scrambled_friend_code_size); std::array<u16, 4>
134 // unscrambled_friend_code; unscrambled_friend_code[0] = scambled_friend_code[0] ^
135 // scambled_friend_code[5]; unscrambled_friend_code[1] = scambled_friend_code[1] ^
136 // scambled_friend_code[5]; unscrambled_friend_code[2] = scambled_friend_code[2] ^
137 // scambled_friend_code[5]; unscrambled_friend_code[3] = scambled_friend_code[3] ^
138 // scambled_friend_code[5];
139
140 u64 result = 0ull;
141 Memory::WriteBlock(unscrambled_friend_codes + (current * sizeof(result)), &result,
142 sizeof(result));
143 }
144
145 LOG_WARNING(Service_FRD, "(STUBBED) called");
146 IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
147 rb.Push(RESULT_SUCCESS);
148 rb.PushStaticBuffer(unscrambled_friend_codes, out_buffer_size, 0);
149}
150
151void SetClientSdkVersion(Service::Interface* self) {
152 u32* cmd_buff = Kernel::GetCommandBuffer();
153
154 const u32 version = cmd_buff[1];
155
156 self->SetVersion(version);
157
158 LOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x%08X", version);
159
160 cmd_buff[1] = RESULT_SUCCESS.raw; // No error
161}
162
163void Init() {
164 using namespace Kernel;
165
166 AddService(new FRD_A_Interface);
167 AddService(new FRD_U_Interface);
168}
169
170void Shutdown() {}
171
172} // namespace FRD
173
174} // namespace Service
diff --git a/src/core/hle/service/frd/frd.h b/src/core/hle/service/frd/frd.h
deleted file mode 100644
index 66a87c8cd..000000000
--- a/src/core/hle/service/frd/frd.h
+++ /dev/null
@@ -1,127 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "common/common_types.h"
8
9namespace Service {
10
11class Interface;
12
13namespace FRD {
14
15struct FriendKey {
16 u32 friend_id;
17 u32 unknown;
18 u64 friend_code;
19};
20
21struct MyPresence {
22 u8 unknown[0x12C];
23};
24
25struct Profile {
26 u8 region;
27 u8 country;
28 u8 area;
29 u8 language;
30 u32 unknown;
31};
32
33/**
34 * FRD::GetMyPresence service function
35 * Inputs:
36 * 64 : sizeof (MyPresence) << 14 | 2
37 * 65 : Address of MyPresence structure
38 * Outputs:
39 * 1 : Result of function, 0 on success, otherwise error code
40 */
41void GetMyPresence(Service::Interface* self);
42
43/**
44 * FRD::GetFriendKeyList service function
45 * Inputs:
46 * 1 : Unknown
47 * 2 : Max friends count
48 * 65 : Address of FriendKey List
49 * Outputs:
50 * 1 : Result of function, 0 on success, otherwise error code
51 * 2 : FriendKey count filled
52 */
53void GetFriendKeyList(Service::Interface* self);
54
55/**
56 * FRD::GetFriendProfile service function
57 * Inputs:
58 * 1 : Friends count
59 * 2 : Friends count << 18 | 2
60 * 3 : Address of FriendKey List
61 * 64 : (count * sizeof (Profile)) << 10 | 2
62 * 65 : Address of Profiles List
63 * Outputs:
64 * 1 : Result of function, 0 on success, otherwise error code
65 */
66void GetFriendProfile(Service::Interface* self);
67
68/**
69 * FRD::GetFriendAttributeFlags service function
70 * Inputs:
71 * 1 : Friends count
72 * 2 : Friends count << 18 | 2
73 * 3 : Address of FriendKey List
74 * 65 : Address of AttributeFlags
75 * Outputs:
76 * 1 : Result of function, 0 on success, otherwise error code
77 */
78void GetFriendAttributeFlags(Service::Interface* self);
79
80/**
81 * FRD::GetMyFriendKey service function
82 * Inputs:
83 * none
84 * Outputs:
85 * 1 : Result of function, 0 on success, otherwise error code
86 * 2-5 : FriendKey
87 */
88void GetMyFriendKey(Service::Interface* self);
89
90/**
91 * FRD::GetMyScreenName service function
92 * Outputs:
93 * 1 : Result of function, 0 on success, otherwise error code
94 * 2 : UTF16 encoded name (max 11 symbols)
95 */
96void GetMyScreenName(Service::Interface* self);
97
98/**
99 * FRD::UnscrambleLocalFriendCode service function
100 * Inputs:
101 * 1 : Friend code count
102 * 2 : ((count * 12) << 14) | 0x402
103 * 3 : Pointer to encoded friend codes. Each is 12 bytes large
104 * 64 : ((count * 8) << 14) | 2
105 * 65 : Pointer to write decoded local friend codes to. Each is 8 bytes large.
106 * Outputs:
107 * 1 : Result of function, 0 on success, otherwise error code
108 */
109void UnscrambleLocalFriendCode(Service::Interface* self);
110
111/**
112 * FRD::SetClientSdkVersion service function
113 * Inputs:
114 * 1 : Used SDK Version
115 * Outputs:
116 * 1 : Result of function, 0 on success, otherwise error code
117 */
118void SetClientSdkVersion(Service::Interface* self);
119
120/// Initialize FRD service(s)
121void Init();
122
123/// Shutdown FRD service(s)
124void Shutdown();
125
126} // namespace FRD
127} // namespace Service
diff --git a/src/core/hle/service/frd/frd_a.cpp b/src/core/hle/service/frd/frd_a.cpp
deleted file mode 100644
index cfc37210b..000000000
--- a/src/core/hle/service/frd/frd_a.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/frd/frd_a.h"
6
7namespace Service {
8namespace FRD {
9
10// Empty arrays are illegal -- commented out until an entry is added.
11// const Interface::FunctionInfo FunctionTable[] = { };
12
13FRD_A_Interface::FRD_A_Interface() {
14 // Register(FunctionTable);
15}
16
17} // namespace FRD
18} // namespace Service
diff --git a/src/core/hle/service/frd/frd_a.h b/src/core/hle/service/frd/frd_a.h
deleted file mode 100644
index 006d1cadd..000000000
--- a/src/core/hle/service/frd/frd_a.h
+++ /dev/null
@@ -1,22 +0,0 @@
1// Copyright 2015 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/service.h"
8
9namespace Service {
10namespace FRD {
11
12class FRD_A_Interface : public Service::Interface {
13public:
14 FRD_A_Interface();
15
16 std::string GetPortName() const override {
17 return "frd:a";
18 }
19};
20
21} // namespace FRD
22} // namespace Service
diff --git a/src/core/hle/service/frd/frd_u.cpp b/src/core/hle/service/frd/frd_u.cpp
deleted file mode 100644
index 6970ff768..000000000
--- a/src/core/hle/service/frd/frd_u.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#include "core/hle/service/frd/frd.h"
6#include "core/hle/service/frd/frd_u.h"
7
8namespace Service {
9namespace FRD {
10
11const Interface::FunctionInfo FunctionTable[] = {
12 {0x00010000, nullptr, "HasLoggedIn"},
13 {0x00020000, nullptr, "IsOnline"},
14 {0x00030000, nullptr, "Login"},
15 {0x00040000, nullptr, "Logout"},
16 {0x00050000, GetMyFriendKey, "GetMyFriendKey"},
17 {0x00060000, nullptr, "GetMyPreference"},
18 {0x00070000, nullptr, "GetMyProfile"},
19 {0x00080000, GetMyPresence, "GetMyPresence"},
20 {0x00090000, GetMyScreenName, "GetMyScreenName"},
21 {0x000A0000, nullptr, "GetMyMii"},
22 {0x000B0000, nullptr, "GetMyLocalAccountId"},
23 {0x000C0000, nullptr, "GetMyPlayingGame"},
24 {0x000D0000, nullptr, "GetMyFavoriteGame"},
25 {0x000E0000, nullptr, "GetMyNcPrincipalId"},
26 {0x000F0000, nullptr, "GetMyComment"},
27 {0x00100040, nullptr, "GetMyPassword"},
28 {0x00110080, GetFriendKeyList, "GetFriendKeyList"},
29 {0x00120042, nullptr, "GetFriendPresence"},
30 {0x00130142, nullptr, "GetFriendScreenName"},
31 {0x00140044, nullptr, "GetFriendMii"},
32 {0x00150042, GetFriendProfile, "GetFriendProfile"},
33 {0x00160042, nullptr, "GetFriendRelationship"},
34 {0x00170042, GetFriendAttributeFlags, "GetFriendAttributeFlags"},
35 {0x00180044, nullptr, "GetFriendPlayingGame"},
36 {0x00190042, nullptr, "GetFriendFavoriteGame"},
37 {0x001A00C4, nullptr, "GetFriendInfo"},
38 {0x001B0080, nullptr, "IsIncludedInFriendList"},
39 {0x001C0042, UnscrambleLocalFriendCode, "UnscrambleLocalFriendCode"},
40 {0x001D0002, nullptr, "UpdateGameModeDescription"},
41 {0x001E02C2, nullptr, "UpdateGameMode"},
42 {0x001F0042, nullptr, "SendInvitation"},
43 {0x00200002, nullptr, "AttachToEventNotification"},
44 {0x00210040, nullptr, "SetNotificationMask"},
45 {0x00220040, nullptr, "GetEventNotification"},
46 {0x00230000, nullptr, "GetLastResponseResult"},
47 {0x00240040, nullptr, "PrincipalIdToFriendCode"},
48 {0x00250080, nullptr, "FriendCodeToPrincipalId"},
49 {0x00260080, nullptr, "IsValidFriendCode"},
50 {0x00270040, nullptr, "ResultToErrorCode"},
51 {0x00280244, nullptr, "RequestGameAuthentication"},
52 {0x00290000, nullptr, "GetGameAuthenticationData"},
53 {0x002A0204, nullptr, "RequestServiceLocator"},
54 {0x002B0000, nullptr, "GetServiceLocatorData"},
55 {0x002C0002, nullptr, "DetectNatProperties"},
56 {0x002D0000, nullptr, "GetNatProperties"},
57 {0x002E0000, nullptr, "GetServerTimeInterval"},
58 {0x002F0040, nullptr, "AllowHalfAwake"},
59 {0x00300000, nullptr, "GetServerTypes"},
60 {0x00310082, nullptr, "GetFriendComment"},
61 {0x00320042, SetClientSdkVersion, "SetClientSdkVersion"},
62 {0x00330000, nullptr, "GetMyApproachContext"},
63 {0x00340046, nullptr, "AddFriendWithApproach"},
64 {0x00350082, nullptr, "DecryptApproachContext"},
65};
66
67FRD_U_Interface::FRD_U_Interface() {
68 Register(FunctionTable);
69}
70
71} // namespace FRD
72} // namespace Service
diff --git a/src/core/hle/service/frd/frd_u.h b/src/core/hle/service/frd/frd_u.h
deleted file mode 100644
index 07e43f155..000000000
--- a/src/core/hle/service/frd/frd_u.h
+++ /dev/null
@@ -1,22 +0,0 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5#pragma once
6
7#include "core/hle/service/service.h"
8
9namespace Service {
10namespace FRD {
11
12class FRD_U_Interface : public Service::Interface {
13public:
14 FRD_U_Interface();
15
16 std::string GetPortName() const override {
17 return "frd:u";
18 }
19};
20
21} // namespace FRD
22} // namespace Service