mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-11 04:35:05 +01:00
Merge pull request #5792 from vitor-k/username
service/frd: return cfg username on GetMyScreenName
This commit is contained in:
commit
67f1e4111d
@ -3,6 +3,7 @@
|
|||||||
// Refer to the license.txt file included.
|
// Refer to the license.txt file included.
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <cstring>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "common/assert.h"
|
#include "common/assert.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
@ -10,10 +11,13 @@
|
|||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/hle/ipc_helpers.h"
|
#include "core/hle/ipc_helpers.h"
|
||||||
#include "core/hle/result.h"
|
#include "core/hle/result.h"
|
||||||
|
#include "core/hle/service/cfg/cfg.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"
|
||||||
#include "core/hle/service/frd/frd_u.h"
|
#include "core/hle/service/frd/frd_u.h"
|
||||||
|
|
||||||
|
SERVICE_CONSTRUCT_IMPL(Service::FRD::Module)
|
||||||
|
|
||||||
namespace Service::FRD {
|
namespace Service::FRD {
|
||||||
|
|
||||||
Module::Interface::Interface(std::shared_ptr<Module> frd, const char* name, u32 max_session)
|
Module::Interface::Interface(std::shared_ptr<Module> frd, const char* name, u32 max_session)
|
||||||
@ -93,16 +97,21 @@ void Module::Interface::GetMyScreenName(Kernel::HLERequestContext& ctx) {
|
|||||||
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
|
IPC::RequestBuilder rb = rp.MakeBuilder(7, 0);
|
||||||
|
|
||||||
struct ScreenName {
|
struct ScreenName {
|
||||||
std::array<char16_t, 12> name;
|
// 20 bytes according to 3dbrew
|
||||||
|
std::array<char16_t, 10> name;
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: (mailwl) get the name from config
|
auto cfg = Service::CFG::GetModule(frd->system);
|
||||||
ScreenName screen_name{u"Citra"};
|
ASSERT_MSG(cfg, "CFG Module missing!");
|
||||||
|
auto username = cfg->GetUsername();
|
||||||
|
ASSERT_MSG(username.length() <= 10, "Username longer than expected!");
|
||||||
|
ScreenName screen_name{};
|
||||||
|
std::memcpy(screen_name.name.data(), username.data(), username.length() * sizeof(char16_t));
|
||||||
|
|
||||||
rb.Push(RESULT_SUCCESS);
|
rb.Push(RESULT_SUCCESS);
|
||||||
rb.PushRaw(screen_name);
|
rb.PushRaw(screen_name);
|
||||||
|
|
||||||
LOG_WARNING(Service_FRD, "(STUBBED) called");
|
LOG_INFO(Service_FRD, "returning the username defined in cfg");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) {
|
void Module::Interface::UnscrambleLocalFriendCode(Kernel::HLERequestContext& ctx) {
|
||||||
@ -147,12 +156,12 @@ void Module::Interface::SetClientSdkVersion(Kernel::HLERequestContext& ctx) {
|
|||||||
LOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x{:08X}", version);
|
LOG_WARNING(Service_FRD, "(STUBBED) called, version: 0x{:08X}", version);
|
||||||
}
|
}
|
||||||
|
|
||||||
Module::Module() = default;
|
Module::Module(Core::System& system) : system(system){};
|
||||||
Module::~Module() = default;
|
Module::~Module() = default;
|
||||||
|
|
||||||
void InstallInterfaces(Core::System& system) {
|
void InstallInterfaces(Core::System& system) {
|
||||||
auto& service_manager = system.ServiceManager();
|
auto& service_manager = system.ServiceManager();
|
||||||
auto frd = std::make_shared<Module>();
|
auto frd = std::make_shared<Module>(system);
|
||||||
std::make_shared<FRD_U>(frd)->InstallAsService(service_manager);
|
std::make_shared<FRD_U>(frd)->InstallAsService(service_manager);
|
||||||
std::make_shared<FRD_A>(frd)->InstallAsService(service_manager);
|
std::make_shared<FRD_A>(frd)->InstallAsService(service_manager);
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ struct Profile {
|
|||||||
|
|
||||||
class Module final {
|
class Module final {
|
||||||
public:
|
public:
|
||||||
Module();
|
explicit Module(Core::System& system);
|
||||||
~Module();
|
~Module();
|
||||||
|
|
||||||
class Interface : public ServiceFramework<Interface> {
|
class Interface : public ServiceFramework<Interface> {
|
||||||
@ -153,6 +153,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
FriendKey my_friend_key = {0, 0, 0ull};
|
FriendKey my_friend_key = {0, 0, 0ull};
|
||||||
MyPresence my_presence = {};
|
MyPresence my_presence = {};
|
||||||
|
Core::System& system;
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
void serialize(Archive& ar, const unsigned int) {
|
void serialize(Archive& ar, const unsigned int) {
|
||||||
@ -165,3 +166,5 @@ private:
|
|||||||
void InstallInterfaces(Core::System& system);
|
void InstallInterfaces(Core::System& system);
|
||||||
|
|
||||||
} // namespace Service::FRD
|
} // namespace Service::FRD
|
||||||
|
|
||||||
|
SERVICE_CONSTRUCT(Service::FRD::Module)
|
||||||
|
Loading…
Reference in New Issue
Block a user