forked from minecraft-linux/mcpelauncher-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathxbox_live_helper.h
70 lines (46 loc) · 1.95 KB
/
xbox_live_helper.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#pragma once
#include <memory>
#include <msa/client/service_launcher.h>
#include <msa/client/service_client.h>
#include <cll/event_manager.h>
#include "cll_upload_auth_step.h"
#include <fake-jni/jvm.h>
class XboxLiveHelper {
private:
static std::string const MSA_CLIENT_ID;
static std::string const MSA_COBRAND_ID;
static XboxLiveHelper instance;
msa::client::ServiceLauncher launcher;
std::unique_ptr<msa::client::ServiceClient> client;
std::atomic_bool triedToCreateClient;
std::mutex clientMutex;
std::mutex cllMutex;
std::unique_ptr<cll::EventManager> cll;
CllUploadAuthStep cllAuthStep;
FakeJni::Jvm *vm;
msa::client::ServiceClient* getMsaClientOrNull();
msa::client::ServiceClient& getMsaClient();
public:
static XboxLiveHelper& getInstance() {
return instance;
}
static std::string findMsa();
XboxLiveHelper();
void shutdown() {
cll.reset();
client.reset();
}
void invokeMsaAuthFlow(std::function<void (std::string const& cid, std::string const& binaryToken)> success_cb,
std::function<void (simpleipc::rpc_error_code, std::string const&)> error_cb);
simpleipc::client::rpc_call<std::shared_ptr<msa::client::Token>> requestXblToken(std::string const& cid,
bool silent);
void requestXblToken(std::string const& cid, bool silent,
std::function<void (std::string const& cid, std::string const& binaryToken)> success_cb,
std::function<void (simpleipc::rpc_error_code, std::string const&)> error_cb);
std::string getCllMsaToken(std::string const& cid);
void setJvm(FakeJni::Jvm *vm);
std::string getCllXToken(bool refresh);
std::string getCllXTicket(std::string const& xuid);
void initCll(std::string const& cid = std::string());
void logCll(cll::Event const& event);
};