steamworks.js-timmy 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/client.d.ts +415 -0
- package/dist/linux64/client.d.ts +927 -0
- package/dist/linux64/index.js +61 -577
- package/dist/linux64/steamworksjs.linux-x64-gnu.node +0 -0
- package/dist/osx/client.d.ts +927 -0
- package/dist/osx/index.js +61 -577
- package/dist/osx/steamworksjs.darwin-arm64.node +0 -0
- package/dist/osx/steamworksjs.darwin-x64.node +0 -0
- package/dist/win64/client.d.ts +927 -0
- package/dist/win64/index.js +77 -593
- package/dist/win64/steamworksjs.win32-x64-msvc.node +0 -0
- package/index.d.ts +52 -0
- package/package.json +1 -1
package/dist/osx/index.js
CHANGED
|
@@ -1,593 +1,77 @@
|
|
|
1
|
-
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
// @ts-nocheck
|
|
4
|
-
/* auto-generated by NAPI-RS */
|
|
1
|
+
const { platform, arch } = process
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
/** @typedef {typeof import('./client.d')} Client */
|
|
4
|
+
/** @type {Client} */
|
|
5
|
+
let nativeBinding = undefined
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
musl = isMuslFromReport()
|
|
19
|
-
}
|
|
20
|
-
if (musl === null) {
|
|
21
|
-
musl = isMuslFromChildProcess()
|
|
7
|
+
if (platform === 'win32' && arch === 'x64') {
|
|
8
|
+
nativeBinding = require('./dist/win64/steamworksjs.win32-x64-msvc.node')
|
|
9
|
+
} else if (platform === 'linux' && arch === 'x64') {
|
|
10
|
+
nativeBinding = require('./dist/linux64/steamworksjs.linux-x64-gnu.node')
|
|
11
|
+
} else if (platform === 'darwin') {
|
|
12
|
+
if (arch === 'x64') {
|
|
13
|
+
nativeBinding = require('./dist/osx/steamworksjs.darwin-x64.node')
|
|
14
|
+
} else if (arch === 'arm64') {
|
|
15
|
+
nativeBinding = require('./dist/osx/steamworksjs.darwin-arm64.node')
|
|
22
16
|
}
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
} else {
|
|
18
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
25
19
|
}
|
|
26
20
|
|
|
27
|
-
|
|
21
|
+
let runCallbacksInterval = undefined
|
|
28
22
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the steam client or throw an error if it fails
|
|
25
|
+
* @param {number} [appId] - App ID of the game to load, if undefined, will search for a steam_appid.txt file
|
|
26
|
+
* @returns {Omit<Client, 'init' | 'runCallbacks'>}
|
|
27
|
+
*/
|
|
28
|
+
module.exports.init = (appId) => {
|
|
29
|
+
const { init: internalInit, runCallbacks, restartAppIfNecessary, ...api } = nativeBinding
|
|
36
30
|
|
|
37
|
-
|
|
38
|
-
let report = null
|
|
39
|
-
if (typeof process.report?.getReport === 'function') {
|
|
40
|
-
process.report.excludeNetwork = true
|
|
41
|
-
report = process.report.getReport()
|
|
42
|
-
}
|
|
43
|
-
if (!report) {
|
|
44
|
-
return null
|
|
45
|
-
}
|
|
46
|
-
if (report.header && report.header.glibcVersionRuntime) {
|
|
47
|
-
return false
|
|
48
|
-
}
|
|
49
|
-
if (Array.isArray(report.sharedObjects)) {
|
|
50
|
-
if (report.sharedObjects.some(isFileMusl)) {
|
|
51
|
-
return true
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return false
|
|
55
|
-
}
|
|
31
|
+
internalInit(appId)
|
|
56
32
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
|
|
60
|
-
} catch (e) {
|
|
61
|
-
// If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
|
|
62
|
-
return false
|
|
63
|
-
}
|
|
64
|
-
}
|
|
33
|
+
clearInterval(runCallbacksInterval)
|
|
34
|
+
runCallbacksInterval = setInterval(runCallbacks, 1000 / 30)
|
|
65
35
|
|
|
66
|
-
|
|
67
|
-
if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
|
|
68
|
-
try {
|
|
69
|
-
return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
|
|
70
|
-
} catch (err) {
|
|
71
|
-
loadErrors.push(err)
|
|
72
|
-
}
|
|
73
|
-
} else if (process.platform === 'android') {
|
|
74
|
-
if (process.arch === 'arm64') {
|
|
75
|
-
try {
|
|
76
|
-
return require('./steamworksjs.android-arm64.node')
|
|
77
|
-
} catch (e) {
|
|
78
|
-
loadErrors.push(e)
|
|
79
|
-
}
|
|
80
|
-
try {
|
|
81
|
-
const binding = require('steamworks.js-timmy-android-arm64')
|
|
82
|
-
const bindingPackageVersion = require('steamworks.js-timmy-android-arm64/package.json').version
|
|
83
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
84
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
85
|
-
}
|
|
86
|
-
return binding
|
|
87
|
-
} catch (e) {
|
|
88
|
-
loadErrors.push(e)
|
|
89
|
-
}
|
|
90
|
-
} else if (process.arch === 'arm') {
|
|
91
|
-
try {
|
|
92
|
-
return require('./steamworksjs.android-arm-eabi.node')
|
|
93
|
-
} catch (e) {
|
|
94
|
-
loadErrors.push(e)
|
|
95
|
-
}
|
|
96
|
-
try {
|
|
97
|
-
const binding = require('steamworks.js-timmy-android-arm-eabi')
|
|
98
|
-
const bindingPackageVersion = require('steamworks.js-timmy-android-arm-eabi/package.json').version
|
|
99
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
100
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
101
|
-
}
|
|
102
|
-
return binding
|
|
103
|
-
} catch (e) {
|
|
104
|
-
loadErrors.push(e)
|
|
105
|
-
}
|
|
106
|
-
} else {
|
|
107
|
-
loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
|
|
108
|
-
}
|
|
109
|
-
} else if (process.platform === 'win32') {
|
|
110
|
-
if (process.arch === 'x64') {
|
|
111
|
-
if (process.report?.getReport?.()?.header?.osName?.startsWith?.('MINGW')) {
|
|
112
|
-
try {
|
|
113
|
-
return require('./steamworksjs.win32-x64-gnu.node')
|
|
114
|
-
} catch (e) {
|
|
115
|
-
loadErrors.push(e)
|
|
116
|
-
}
|
|
117
|
-
try {
|
|
118
|
-
const binding = require('steamworks.js-timmy-win32-x64-gnu')
|
|
119
|
-
const bindingPackageVersion = require('steamworks.js-timmy-win32-x64-gnu/package.json').version
|
|
120
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
121
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
122
|
-
}
|
|
123
|
-
return binding
|
|
124
|
-
} catch (e) {
|
|
125
|
-
loadErrors.push(e)
|
|
126
|
-
}
|
|
127
|
-
} else {
|
|
128
|
-
try {
|
|
129
|
-
return require('./steamworksjs.win32-x64-msvc.node')
|
|
130
|
-
} catch (e) {
|
|
131
|
-
loadErrors.push(e)
|
|
132
|
-
}
|
|
133
|
-
try {
|
|
134
|
-
const binding = require('steamworks.js-timmy-win32-x64-msvc')
|
|
135
|
-
const bindingPackageVersion = require('steamworks.js-timmy-win32-x64-msvc/package.json').version
|
|
136
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
137
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
138
|
-
}
|
|
139
|
-
return binding
|
|
140
|
-
} catch (e) {
|
|
141
|
-
loadErrors.push(e)
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
} else if (process.arch === 'ia32') {
|
|
145
|
-
try {
|
|
146
|
-
return require('./steamworksjs.win32-ia32-msvc.node')
|
|
147
|
-
} catch (e) {
|
|
148
|
-
loadErrors.push(e)
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
const binding = require('steamworks.js-timmy-win32-ia32-msvc')
|
|
152
|
-
const bindingPackageVersion = require('steamworks.js-timmy-win32-ia32-msvc/package.json').version
|
|
153
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
154
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
155
|
-
}
|
|
156
|
-
return binding
|
|
157
|
-
} catch (e) {
|
|
158
|
-
loadErrors.push(e)
|
|
159
|
-
}
|
|
160
|
-
} else if (process.arch === 'arm64') {
|
|
161
|
-
try {
|
|
162
|
-
return require('./steamworksjs.win32-arm64-msvc.node')
|
|
163
|
-
} catch (e) {
|
|
164
|
-
loadErrors.push(e)
|
|
165
|
-
}
|
|
166
|
-
try {
|
|
167
|
-
const binding = require('steamworks.js-timmy-win32-arm64-msvc')
|
|
168
|
-
const bindingPackageVersion = require('steamworks.js-timmy-win32-arm64-msvc/package.json').version
|
|
169
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
170
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
171
|
-
}
|
|
172
|
-
return binding
|
|
173
|
-
} catch (e) {
|
|
174
|
-
loadErrors.push(e)
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
|
|
178
|
-
}
|
|
179
|
-
} else if (process.platform === 'darwin') {
|
|
180
|
-
try {
|
|
181
|
-
return require('./steamworksjs.darwin-universal.node')
|
|
182
|
-
} catch (e) {
|
|
183
|
-
loadErrors.push(e)
|
|
184
|
-
}
|
|
185
|
-
try {
|
|
186
|
-
const binding = require('steamworks.js-timmy-darwin-universal')
|
|
187
|
-
const bindingPackageVersion = require('steamworks.js-timmy-darwin-universal/package.json').version
|
|
188
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
189
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
190
|
-
}
|
|
191
|
-
return binding
|
|
192
|
-
} catch (e) {
|
|
193
|
-
loadErrors.push(e)
|
|
194
|
-
}
|
|
195
|
-
if (process.arch === 'x64') {
|
|
196
|
-
try {
|
|
197
|
-
return require('./steamworksjs.darwin-x64.node')
|
|
198
|
-
} catch (e) {
|
|
199
|
-
loadErrors.push(e)
|
|
200
|
-
}
|
|
201
|
-
try {
|
|
202
|
-
const binding = require('steamworks.js-timmy-darwin-x64')
|
|
203
|
-
const bindingPackageVersion = require('steamworks.js-timmy-darwin-x64/package.json').version
|
|
204
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
205
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
206
|
-
}
|
|
207
|
-
return binding
|
|
208
|
-
} catch (e) {
|
|
209
|
-
loadErrors.push(e)
|
|
210
|
-
}
|
|
211
|
-
} else if (process.arch === 'arm64') {
|
|
212
|
-
try {
|
|
213
|
-
return require('./steamworksjs.darwin-arm64.node')
|
|
214
|
-
} catch (e) {
|
|
215
|
-
loadErrors.push(e)
|
|
216
|
-
}
|
|
217
|
-
try {
|
|
218
|
-
const binding = require('steamworks.js-timmy-darwin-arm64')
|
|
219
|
-
const bindingPackageVersion = require('steamworks.js-timmy-darwin-arm64/package.json').version
|
|
220
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
221
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
222
|
-
}
|
|
223
|
-
return binding
|
|
224
|
-
} catch (e) {
|
|
225
|
-
loadErrors.push(e)
|
|
226
|
-
}
|
|
227
|
-
} else {
|
|
228
|
-
loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
|
|
229
|
-
}
|
|
230
|
-
} else if (process.platform === 'freebsd') {
|
|
231
|
-
if (process.arch === 'x64') {
|
|
232
|
-
try {
|
|
233
|
-
return require('./steamworksjs.freebsd-x64.node')
|
|
234
|
-
} catch (e) {
|
|
235
|
-
loadErrors.push(e)
|
|
236
|
-
}
|
|
237
|
-
try {
|
|
238
|
-
const binding = require('steamworks.js-timmy-freebsd-x64')
|
|
239
|
-
const bindingPackageVersion = require('steamworks.js-timmy-freebsd-x64/package.json').version
|
|
240
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
241
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
242
|
-
}
|
|
243
|
-
return binding
|
|
244
|
-
} catch (e) {
|
|
245
|
-
loadErrors.push(e)
|
|
246
|
-
}
|
|
247
|
-
} else if (process.arch === 'arm64') {
|
|
248
|
-
try {
|
|
249
|
-
return require('./steamworksjs.freebsd-arm64.node')
|
|
250
|
-
} catch (e) {
|
|
251
|
-
loadErrors.push(e)
|
|
252
|
-
}
|
|
253
|
-
try {
|
|
254
|
-
const binding = require('steamworks.js-timmy-freebsd-arm64')
|
|
255
|
-
const bindingPackageVersion = require('steamworks.js-timmy-freebsd-arm64/package.json').version
|
|
256
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
257
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
258
|
-
}
|
|
259
|
-
return binding
|
|
260
|
-
} catch (e) {
|
|
261
|
-
loadErrors.push(e)
|
|
262
|
-
}
|
|
263
|
-
} else {
|
|
264
|
-
loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
|
|
265
|
-
}
|
|
266
|
-
} else if (process.platform === 'linux') {
|
|
267
|
-
if (process.arch === 'x64') {
|
|
268
|
-
if (isMusl()) {
|
|
269
|
-
try {
|
|
270
|
-
return require('./steamworksjs.linux-x64-musl.node')
|
|
271
|
-
} catch (e) {
|
|
272
|
-
loadErrors.push(e)
|
|
273
|
-
}
|
|
274
|
-
try {
|
|
275
|
-
const binding = require('steamworks.js-timmy-linux-x64-musl')
|
|
276
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-x64-musl/package.json').version
|
|
277
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
278
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
279
|
-
}
|
|
280
|
-
return binding
|
|
281
|
-
} catch (e) {
|
|
282
|
-
loadErrors.push(e)
|
|
283
|
-
}
|
|
284
|
-
} else {
|
|
285
|
-
try {
|
|
286
|
-
return require('./steamworksjs.linux-x64-gnu.node')
|
|
287
|
-
} catch (e) {
|
|
288
|
-
loadErrors.push(e)
|
|
289
|
-
}
|
|
290
|
-
try {
|
|
291
|
-
const binding = require('steamworks.js-timmy-linux-x64-gnu')
|
|
292
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-x64-gnu/package.json').version
|
|
293
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
294
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
295
|
-
}
|
|
296
|
-
return binding
|
|
297
|
-
} catch (e) {
|
|
298
|
-
loadErrors.push(e)
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
} else if (process.arch === 'arm64') {
|
|
302
|
-
if (isMusl()) {
|
|
303
|
-
try {
|
|
304
|
-
return require('./steamworksjs.linux-arm64-musl.node')
|
|
305
|
-
} catch (e) {
|
|
306
|
-
loadErrors.push(e)
|
|
307
|
-
}
|
|
308
|
-
try {
|
|
309
|
-
const binding = require('steamworks.js-timmy-linux-arm64-musl')
|
|
310
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-arm64-musl/package.json').version
|
|
311
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
312
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
313
|
-
}
|
|
314
|
-
return binding
|
|
315
|
-
} catch (e) {
|
|
316
|
-
loadErrors.push(e)
|
|
317
|
-
}
|
|
318
|
-
} else {
|
|
319
|
-
try {
|
|
320
|
-
return require('./steamworksjs.linux-arm64-gnu.node')
|
|
321
|
-
} catch (e) {
|
|
322
|
-
loadErrors.push(e)
|
|
323
|
-
}
|
|
324
|
-
try {
|
|
325
|
-
const binding = require('steamworks.js-timmy-linux-arm64-gnu')
|
|
326
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-arm64-gnu/package.json').version
|
|
327
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
328
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
329
|
-
}
|
|
330
|
-
return binding
|
|
331
|
-
} catch (e) {
|
|
332
|
-
loadErrors.push(e)
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
} else if (process.arch === 'arm') {
|
|
336
|
-
if (isMusl()) {
|
|
337
|
-
try {
|
|
338
|
-
return require('./steamworksjs.linux-arm-musleabihf.node')
|
|
339
|
-
} catch (e) {
|
|
340
|
-
loadErrors.push(e)
|
|
341
|
-
}
|
|
342
|
-
try {
|
|
343
|
-
const binding = require('steamworks.js-timmy-linux-arm-musleabihf')
|
|
344
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-arm-musleabihf/package.json').version
|
|
345
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
346
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
347
|
-
}
|
|
348
|
-
return binding
|
|
349
|
-
} catch (e) {
|
|
350
|
-
loadErrors.push(e)
|
|
351
|
-
}
|
|
352
|
-
} else {
|
|
353
|
-
try {
|
|
354
|
-
return require('./steamworksjs.linux-arm-gnueabihf.node')
|
|
355
|
-
} catch (e) {
|
|
356
|
-
loadErrors.push(e)
|
|
357
|
-
}
|
|
358
|
-
try {
|
|
359
|
-
const binding = require('steamworks.js-timmy-linux-arm-gnueabihf')
|
|
360
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-arm-gnueabihf/package.json').version
|
|
361
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
362
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
363
|
-
}
|
|
364
|
-
return binding
|
|
365
|
-
} catch (e) {
|
|
366
|
-
loadErrors.push(e)
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
} else if (process.arch === 'loong64') {
|
|
370
|
-
if (isMusl()) {
|
|
371
|
-
try {
|
|
372
|
-
return require('./steamworksjs.linux-loong64-musl.node')
|
|
373
|
-
} catch (e) {
|
|
374
|
-
loadErrors.push(e)
|
|
375
|
-
}
|
|
376
|
-
try {
|
|
377
|
-
const binding = require('steamworks.js-timmy-linux-loong64-musl')
|
|
378
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-loong64-musl/package.json').version
|
|
379
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
380
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
381
|
-
}
|
|
382
|
-
return binding
|
|
383
|
-
} catch (e) {
|
|
384
|
-
loadErrors.push(e)
|
|
385
|
-
}
|
|
386
|
-
} else {
|
|
387
|
-
try {
|
|
388
|
-
return require('./steamworksjs.linux-loong64-gnu.node')
|
|
389
|
-
} catch (e) {
|
|
390
|
-
loadErrors.push(e)
|
|
391
|
-
}
|
|
392
|
-
try {
|
|
393
|
-
const binding = require('steamworks.js-timmy-linux-loong64-gnu')
|
|
394
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-loong64-gnu/package.json').version
|
|
395
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
396
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
397
|
-
}
|
|
398
|
-
return binding
|
|
399
|
-
} catch (e) {
|
|
400
|
-
loadErrors.push(e)
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
} else if (process.arch === 'riscv64') {
|
|
404
|
-
if (isMusl()) {
|
|
405
|
-
try {
|
|
406
|
-
return require('./steamworksjs.linux-riscv64-musl.node')
|
|
407
|
-
} catch (e) {
|
|
408
|
-
loadErrors.push(e)
|
|
409
|
-
}
|
|
410
|
-
try {
|
|
411
|
-
const binding = require('steamworks.js-timmy-linux-riscv64-musl')
|
|
412
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-riscv64-musl/package.json').version
|
|
413
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
414
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
415
|
-
}
|
|
416
|
-
return binding
|
|
417
|
-
} catch (e) {
|
|
418
|
-
loadErrors.push(e)
|
|
419
|
-
}
|
|
420
|
-
} else {
|
|
421
|
-
try {
|
|
422
|
-
return require('./steamworksjs.linux-riscv64-gnu.node')
|
|
423
|
-
} catch (e) {
|
|
424
|
-
loadErrors.push(e)
|
|
425
|
-
}
|
|
426
|
-
try {
|
|
427
|
-
const binding = require('steamworks.js-timmy-linux-riscv64-gnu')
|
|
428
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-riscv64-gnu/package.json').version
|
|
429
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
430
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
431
|
-
}
|
|
432
|
-
return binding
|
|
433
|
-
} catch (e) {
|
|
434
|
-
loadErrors.push(e)
|
|
435
|
-
}
|
|
436
|
-
}
|
|
437
|
-
} else if (process.arch === 'ppc64') {
|
|
438
|
-
try {
|
|
439
|
-
return require('./steamworksjs.linux-ppc64-gnu.node')
|
|
440
|
-
} catch (e) {
|
|
441
|
-
loadErrors.push(e)
|
|
442
|
-
}
|
|
443
|
-
try {
|
|
444
|
-
const binding = require('steamworks.js-timmy-linux-ppc64-gnu')
|
|
445
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-ppc64-gnu/package.json').version
|
|
446
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
447
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
448
|
-
}
|
|
449
|
-
return binding
|
|
450
|
-
} catch (e) {
|
|
451
|
-
loadErrors.push(e)
|
|
452
|
-
}
|
|
453
|
-
} else if (process.arch === 's390x') {
|
|
454
|
-
try {
|
|
455
|
-
return require('./steamworksjs.linux-s390x-gnu.node')
|
|
456
|
-
} catch (e) {
|
|
457
|
-
loadErrors.push(e)
|
|
458
|
-
}
|
|
459
|
-
try {
|
|
460
|
-
const binding = require('steamworks.js-timmy-linux-s390x-gnu')
|
|
461
|
-
const bindingPackageVersion = require('steamworks.js-timmy-linux-s390x-gnu/package.json').version
|
|
462
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
463
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
464
|
-
}
|
|
465
|
-
return binding
|
|
466
|
-
} catch (e) {
|
|
467
|
-
loadErrors.push(e)
|
|
468
|
-
}
|
|
469
|
-
} else {
|
|
470
|
-
loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
|
|
471
|
-
}
|
|
472
|
-
} else if (process.platform === 'openharmony') {
|
|
473
|
-
if (process.arch === 'arm64') {
|
|
474
|
-
try {
|
|
475
|
-
return require('./steamworksjs.openharmony-arm64.node')
|
|
476
|
-
} catch (e) {
|
|
477
|
-
loadErrors.push(e)
|
|
478
|
-
}
|
|
479
|
-
try {
|
|
480
|
-
const binding = require('steamworks.js-timmy-openharmony-arm64')
|
|
481
|
-
const bindingPackageVersion = require('steamworks.js-timmy-openharmony-arm64/package.json').version
|
|
482
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
483
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
484
|
-
}
|
|
485
|
-
return binding
|
|
486
|
-
} catch (e) {
|
|
487
|
-
loadErrors.push(e)
|
|
488
|
-
}
|
|
489
|
-
} else if (process.arch === 'x64') {
|
|
490
|
-
try {
|
|
491
|
-
return require('./steamworksjs.openharmony-x64.node')
|
|
492
|
-
} catch (e) {
|
|
493
|
-
loadErrors.push(e)
|
|
494
|
-
}
|
|
495
|
-
try {
|
|
496
|
-
const binding = require('steamworks.js-timmy-openharmony-x64')
|
|
497
|
-
const bindingPackageVersion = require('steamworks.js-timmy-openharmony-x64/package.json').version
|
|
498
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
499
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
500
|
-
}
|
|
501
|
-
return binding
|
|
502
|
-
} catch (e) {
|
|
503
|
-
loadErrors.push(e)
|
|
504
|
-
}
|
|
505
|
-
} else if (process.arch === 'arm') {
|
|
506
|
-
try {
|
|
507
|
-
return require('./steamworksjs.openharmony-arm.node')
|
|
508
|
-
} catch (e) {
|
|
509
|
-
loadErrors.push(e)
|
|
510
|
-
}
|
|
511
|
-
try {
|
|
512
|
-
const binding = require('steamworks.js-timmy-openharmony-arm')
|
|
513
|
-
const bindingPackageVersion = require('steamworks.js-timmy-openharmony-arm/package.json').version
|
|
514
|
-
if (bindingPackageVersion !== '0.1.2' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
515
|
-
throw new Error(`Native binding package version mismatch, expected 0.1.2 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
516
|
-
}
|
|
517
|
-
return binding
|
|
518
|
-
} catch (e) {
|
|
519
|
-
loadErrors.push(e)
|
|
520
|
-
}
|
|
521
|
-
} else {
|
|
522
|
-
loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
|
|
523
|
-
}
|
|
524
|
-
} else {
|
|
525
|
-
loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
|
|
526
|
-
}
|
|
36
|
+
return api
|
|
527
37
|
}
|
|
528
38
|
|
|
529
|
-
|
|
39
|
+
/**
|
|
40
|
+
* @param {number} appId - App ID of the game to load
|
|
41
|
+
* {@link https://partner.steamgames.com/doc/api/steam_api#SteamAPI_RestartAppIfNecessary}
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
module.exports.restartAppIfNecessary = (appId) => nativeBinding.restartAppIfNecessary(appId);
|
|
530
45
|
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
wasiBindingError = err
|
|
540
|
-
}
|
|
541
|
-
}
|
|
542
|
-
if (!nativeBinding) {
|
|
543
|
-
try {
|
|
544
|
-
wasiBinding = require('steamworks.js-timmy-wasm32-wasi')
|
|
545
|
-
nativeBinding = wasiBinding
|
|
546
|
-
} catch (err) {
|
|
547
|
-
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
548
|
-
wasiBindingError.cause = err
|
|
549
|
-
loadErrors.push(err)
|
|
550
|
-
}
|
|
46
|
+
/**
|
|
47
|
+
* Enable the steam overlay on electron
|
|
48
|
+
* @param {boolean} [disableEachFrameInvalidation] - Should attach a single pixel to be rendered each frame
|
|
49
|
+
*/
|
|
50
|
+
module.exports.electronEnableSteamOverlay = (disableEachFrameInvalidation) => {
|
|
51
|
+
const electron = require('electron')
|
|
52
|
+
if (!electron) {
|
|
53
|
+
throw new Error('Electron module not found')
|
|
551
54
|
}
|
|
552
|
-
}
|
|
553
|
-
if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
|
|
554
|
-
const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
|
|
555
|
-
error.cause = wasiBindingError
|
|
556
|
-
throw error
|
|
557
|
-
}
|
|
558
|
-
}
|
|
559
55
|
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
56
|
+
electron.app.commandLine.appendSwitch('in-process-gpu')
|
|
57
|
+
electron.app.commandLine.appendSwitch('disable-direct-composition')
|
|
58
|
+
|
|
59
|
+
if (!disableEachFrameInvalidation) {
|
|
60
|
+
/** @param {electron.BrowserWindow} browserWindow */
|
|
61
|
+
const attachFrameInvalidator = (browserWindow) => {
|
|
62
|
+
browserWindow.steamworksRepaintInterval = setInterval(() => {
|
|
63
|
+
if (browserWindow.isDestroyed()) {
|
|
64
|
+
clearInterval(browserWindow.steamworksRepaintInterval)
|
|
65
|
+
} else if (!browserWindow.webContents.isPainting()) {
|
|
66
|
+
browserWindow.webContents.invalidate()
|
|
67
|
+
}
|
|
68
|
+
}, 1000 / 60)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
electron.BrowserWindow.getAllWindows().forEach(attachFrameInvalidator)
|
|
72
|
+
electron.app.on('browser-window-created', (_, bw) => attachFrameInvalidator(bw))
|
|
73
|
+
}
|
|
575
74
|
}
|
|
576
75
|
|
|
577
|
-
|
|
578
|
-
module.exports.
|
|
579
|
-
module.exports.restartAppIfNecessary = nativeBinding.restartAppIfNecessary
|
|
580
|
-
module.exports.runCallbacks = nativeBinding.runCallbacks
|
|
581
|
-
module.exports.achievement = nativeBinding.achievement
|
|
582
|
-
module.exports.apps = nativeBinding.apps
|
|
583
|
-
module.exports.auth = nativeBinding.auth
|
|
584
|
-
module.exports.callback = nativeBinding.callback
|
|
585
|
-
module.exports.cloud = nativeBinding.cloud
|
|
586
|
-
module.exports.input = nativeBinding.input
|
|
587
|
-
module.exports.localplayer = nativeBinding.localplayer
|
|
588
|
-
module.exports.matchmaking = nativeBinding.matchmaking
|
|
589
|
-
module.exports.networking = nativeBinding.networking
|
|
590
|
-
module.exports.overlay = nativeBinding.overlay
|
|
591
|
-
module.exports.stats = nativeBinding.stats
|
|
592
|
-
module.exports.utils = nativeBinding.utils
|
|
593
|
-
module.exports.workshop = nativeBinding.workshop
|
|
76
|
+
const SteamCallback = nativeBinding.callback.SteamCallback
|
|
77
|
+
module.exports.SteamCallback = SteamCallback
|
|
Binary file
|
|
Binary file
|