stubbed frd::UnscrambleLocalFriendCode (#2827)
This commit is contained in:
parent
68db4f3ece
commit
7dbbd8a02e
@ -6,6 +6,7 @@
|
|||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/string_util.h"
|
#include "common/string_util.h"
|
||||||
#include "core/hle/ipc.h"
|
#include "core/hle/ipc.h"
|
||||||
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
#include "core/hle/service/frd/frd.h"
|
#include "core/hle/service/frd/frd.h"
|
||||||
#include "core/hle/service/frd/frd_a.h"
|
#include "core/hle/service/frd/frd_a.h"
|
||||||
@ -105,6 +106,48 @@ void GetMyScreenName(Service::Interface* self) {
|
|||||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UnscrambleLocalFriendCode(Service::Interface* self) {
|
||||||
|
const size_t scrambled_friend_code_size = 12;
|
||||||
|
const size_t friend_code_size = 8;
|
||||||
|
|
||||||
|
IPC::RequestParser rp(Kernel::GetCommandBuffer(), 0x1C, 1, 2);
|
||||||
|
const u32 friend_code_count = rp.Pop<u32>();
|
||||||
|
size_t in_buffer_size;
|
||||||
|
const VAddr scrambled_friend_codes = rp.PopStaticBuffer(&in_buffer_size, false);
|
||||||
|
ASSERT_MSG(in_buffer_size == (friend_code_count * scrambled_friend_code_size),
|
||||||
|
"Wrong input buffer size");
|
||||||
|
|
||||||
|
size_t out_buffer_size;
|
||||||
|
VAddr unscrambled_friend_codes = rp.PeekStaticBuffer(0, &out_buffer_size);
|
||||||
|
ASSERT_MSG(out_buffer_size == (friend_code_count * friend_code_size),
|
||||||
|
"Wrong output buffer size");
|
||||||
|
|
||||||
|
for (u32 current = 0; current < friend_code_count; ++current) {
|
||||||
|
// TODO(B3N30): Unscramble the codes and compare them against the friend list
|
||||||
|
// Only write 0 if the code isn't in friend list, otherwise write the
|
||||||
|
// unscrambled one
|
||||||
|
//
|
||||||
|
// Code for unscrambling (should be compared to HW):
|
||||||
|
// std::array<u16, 6> scambled_friend_code;
|
||||||
|
// Memory::ReadBlock(scrambled_friend_codes+(current*scrambled_friend_code_size),
|
||||||
|
// scambled_friend_code.data(), scrambled_friend_code_size); std::array<u16, 4>
|
||||||
|
// unscrambled_friend_code; unscrambled_friend_code[0] = scambled_friend_code[0] ^
|
||||||
|
// scambled_friend_code[5]; unscrambled_friend_code[1] = scambled_friend_code[1] ^
|
||||||
|
// scambled_friend_code[5]; unscrambled_friend_code[2] = scambled_friend_code[2] ^
|
||||||
|
// scambled_friend_code[5]; unscrambled_friend_code[3] = scambled_friend_code[3] ^
|
||||||
|
// scambled_friend_code[5];
|
||||||
|
|
||||||
|
u64 result = 0ull;
|
||||||
|
Memory::WriteBlock(unscrambled_friend_codes + (current * sizeof(result)), &result,
|
||||||
|
sizeof(result));
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
||||||
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
||||||
|
rb.Push(RESULT_SUCCESS);
|
||||||
|
rb.PushStaticBuffer(unscrambled_friend_codes, out_buffer_size, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void SetClientSdkVersion(Service::Interface* self) {
|
void SetClientSdkVersion(Service::Interface* self) {
|
||||||
u32* cmd_buff = Kernel::GetCommandBuffer();
|
u32* cmd_buff = Kernel::GetCommandBuffer();
|
||||||
|
|
||||||
|
@ -95,6 +95,19 @@ void GetMyFriendKey(Service::Interface* self);
|
|||||||
*/
|
*/
|
||||||
void GetMyScreenName(Service::Interface* self);
|
void GetMyScreenName(Service::Interface* self);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* FRD::UnscrambleLocalFriendCode service function
|
||||||
|
* Inputs:
|
||||||
|
* 1 : Friend code count
|
||||||
|
* 2 : ((count * 12) << 14) | 0x402
|
||||||
|
* 3 : Pointer to encoded friend codes. Each is 12 bytes large
|
||||||
|
* 64 : ((count * 8) << 14) | 2
|
||||||
|
* 65 : Pointer to write decoded local friend codes to. Each is 8 bytes large.
|
||||||
|
* Outputs:
|
||||||
|
* 1 : Result of function, 0 on success, otherwise error code
|
||||||
|
*/
|
||||||
|
void UnscrambleLocalFriendCode(Service::Interface* self);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FRD::SetClientSdkVersion service function
|
* FRD::SetClientSdkVersion service function
|
||||||
* Inputs:
|
* Inputs:
|
||||||
|
@ -36,7 +36,7 @@ const Interface::FunctionInfo FunctionTable[] = {
|
|||||||
{0x00190042, nullptr, "GetFriendFavoriteGame"},
|
{0x00190042, nullptr, "GetFriendFavoriteGame"},
|
||||||
{0x001A00C4, nullptr, "GetFriendInfo"},
|
{0x001A00C4, nullptr, "GetFriendInfo"},
|
||||||
{0x001B0080, nullptr, "IsIncludedInFriendList"},
|
{0x001B0080, nullptr, "IsIncludedInFriendList"},
|
||||||
{0x001C0042, nullptr, "UnscrambleLocalFriendCode"},
|
{0x001C0042, UnscrambleLocalFriendCode, "UnscrambleLocalFriendCode"},
|
||||||
{0x001D0002, nullptr, "UpdateGameModeDescription"},
|
{0x001D0002, nullptr, "UpdateGameModeDescription"},
|
||||||
{0x001E02C2, nullptr, "UpdateGameMode"},
|
{0x001E02C2, nullptr, "UpdateGameMode"},
|
||||||
{0x001F0042, nullptr, "SendInvitation"},
|
{0x001F0042, nullptr, "SendInvitation"},
|
||||||
|
Loading…
Reference in New Issue
Block a user