Repository navigation
Expand file tree
/
Copy pathExport.cpp
More file actions
218 lines (181 loc) · 5.78 KB
/
Copy pathExport.cpp
File metadata and controls
218 lines (181 loc) · 5.78 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
#include <cstdint>
#include <cstddef>
#include "SceTypes.hpp"
#include "prx/libc/include/General.hpp"
#include <atomic>
#include <mutex>
// PSN is not emulated: the user is reported as signed out and online queries fail.
static constexpr int SCE_NP_ERROR_INVALID_ARGUMENT = static_cast<int>(0x80550003);
static constexpr int SCE_NP_ERROR_SIGNED_OUT = static_cast<int>(0x80550006);
static constexpr int SCE_NP_ERROR_CALLBACK_ALREADY_REGISTERED = static_cast<int>(0x80550008);
static constexpr int SCE_NP_ERROR_CALLBACK_NOT_REGISTERED = static_cast<int>(0x80550009);
static constexpr uint32_t NP_STATE_SIGNED_OUT = 1;
static constexpr int NP_POLL_ASYNC_FINISHED = 0;
static constexpr uint32_t NP_REACHABILITY_STATE_UNAVAILABLE = 0;
static std::atomic<int> g_nextRequest{1};
namespace {
std::mutex reachabilityMutex;
void* reachabilityCallback = nullptr;
void* reachabilityUserdata = nullptr;
}
extern "C" {
int APS5_VABI sceNpAbortRequest(int req_id) {
(void)req_id;
return 0;
}
int APS5_VABI sceNpCheckCallback(void) {
return 0;
}
int APS5_VABI sceNpCheckNpAvailability(int req_id, const char* user, void* result) {
(void)req_id;
(void)user;
(void)result;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceNpCheckNpReachability(int req_id, int user_id) {
(void)req_id;
(void)user_id;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpCheckPremium(int req_id, const NpCheckPremiumParameter* param, NpCheckPremiumResult* result) {
(void)req_id;
(void)param;
(void)result;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpCreateAsyncRequest(const NpCreateAsyncRequestParameter* param) {
(void)param;
return g_nextRequest.fetch_add(1, std::memory_order_relaxed);
}
int APS5_VABI sceNpCreateRequest(void) {
return g_nextRequest.fetch_add(1, std::memory_order_relaxed);
}
int APS5_VABI sceNpDeleteRequest(int req_id) {
(void)req_id;
return 0;
}
int APS5_VABI sceNpGetAccountAge(int req_id, int user_id, uint8_t* age) {
(void)req_id;
(void)user_id;
if (!age) return SCE_NP_ERROR_INVALID_ARGUMENT;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpGetAccountCountryA(int user_id, void* country_code) {
(void)user_id;
(void)country_code;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpGetAccountIdA(int user_id, uint64_t* account_id) {
(void)user_id;
(void)account_id;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpGetNpId(int user_id, NpId* np_id) {
(void)user_id;
if (!np_id) return SCE_NP_ERROR_INVALID_ARGUMENT;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpGetNpReachabilityState(int user_id, uint32_t* state) {
(void)user_id;
if (!state) return SCE_NP_ERROR_INVALID_ARGUMENT;
*state = NP_REACHABILITY_STATE_UNAVAILABLE;
return 0;
}
int APS5_VABI sceNpGetOnlineId(int user_id, NpOnlineId* online_id) {
(void)user_id;
(void)online_id;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpGetState(int user_id, uint32_t* state) {
(void)user_id;
if (!state) return SCE_NP_ERROR_INVALID_ARGUMENT;
*state = NP_STATE_SIGNED_OUT;
return 0;
}
int APS5_VABI sceNpHasSignedUp(int user_id, bool* has_signed_up) {
(void)user_id;
if (!has_signed_up) return SCE_NP_ERROR_INVALID_ARGUMENT;
*has_signed_up = false;
return 0;
}
int APS5_VABI sceNpPollAsync(int req_id, int* result) {
(void)req_id;
if (result) *result = SCE_NP_ERROR_SIGNED_OUT;
return NP_POLL_ASYNC_FINISHED;
}
void APS5_VABI sceNpRegisterGamePresenceCallback(void* callback, void* userdata) {
(void)callback;
(void)userdata;
NotImplemented_nid_no_patch(__func__);
}
int APS5_VABI sceNpRegisterNpReachabilityStateCallback(void* callback, void* userdata) {
if (!callback) return SCE_NP_ERROR_INVALID_ARGUMENT;
std::lock_guard lock(reachabilityMutex);
if (reachabilityCallback) return SCE_NP_ERROR_CALLBACK_ALREADY_REGISTERED;
reachabilityCallback = callback;
reachabilityUserdata = userdata;
return 0;
}
int APS5_VABI sceNpUnregisterNpReachabilityStateCallback(void) {
std::lock_guard lock(reachabilityMutex);
if (!reachabilityCallback) return SCE_NP_ERROR_CALLBACK_NOT_REGISTERED;
reachabilityCallback = nullptr;
reachabilityUserdata = nullptr;
return 0;
}
int APS5_VABI sceNpRegisterPlusEventCallback(void* callback, void* userdata) {
(void)userdata;
if (!callback) return SCE_NP_ERROR_INVALID_ARGUMENT;
return 0;
}
int APS5_VABI sceNpRegisterPremiumEventCallback(void* callback, void* userdata) {
(void)userdata;
if (!callback) return SCE_NP_ERROR_INVALID_ARGUMENT;
return 0;
}
int APS5_VABI sceNpRegisterStateCallback(void* callback, void* userdata) {
(void)userdata;
if (!callback) return SCE_NP_ERROR_INVALID_ARGUMENT;
return 0;
}
int APS5_VABI sceNpSetContentRestriction(const NpContentRestriction* restriction) {
(void)restriction;
NotImplemented_nid_no_patch(__func__);
return 0;
}
int APS5_VABI sceNpSetNpTitleId(const NpTitleId* title_id, const NpTitleSecret* title_secret) {
(void)title_id;
(void)title_secret;
return 0;
}
int APS5_VABI sceNpUnregisterStateCallback(void) {
return 0;
}
int APS5_VABI sceNpGetAccountLanguage2(int req_id, int user_id, void* language) {
(void)req_id;
(void)user_id;
(void)language;
return SCE_NP_ERROR_SIGNED_OUT;
}
int APS5_VABI sceNpNotifyPremiumFeature(const void* param) {
(void)param;
return 0;
}
int APS5_VABI sceNpRegisterStateCallbackA(void* callback, void* userdata) {
(void)userdata;
if (!callback) return SCE_NP_ERROR_INVALID_ARGUMENT;
return 1;
}
int APS5_VABI sceNpUnregisterStateCallbackA(int callback_id) {
(void)callback_id;
return 0;
}
int APS5_VABI sceNpUnregisterPremiumEventCallback(void) {
return 0;
}
int APS5_VABI sceNpGetUserIdByAccountId() {
NotImplemented_nid_no_patch(__func__);
return 0;
}
}