steamworks.js-timmy 0.1.16 → 0.1.17
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/LICENSE +21 -21
- package/README.md +7 -7
- package/callbacks.d.ts +56 -56
- package/dist/win64/index.js +4 -1
- package/dist/win64/steamworksjs.win32-x64-msvc.node +0 -0
- package/index.js +88 -85
- package/package.json +3 -4
- package/dist/linux64/client.d.ts +0 -961
- package/dist/linux64/index.d.ts +0 -6
- package/dist/linux64/index.js +0 -86
- package/dist/linux64/libsteam_api.so +0 -0
- package/dist/linux64/steamworksjs.linux-x64-gnu.node +0 -0
- package/dist/osx/client.d.ts +0 -961
- package/dist/osx/index.d.ts +0 -6
- package/dist/osx/index.js +0 -86
- package/dist/osx/libsteam_api.dylib +0 -0
- package/dist/osx/steamworksjs.darwin-arm64.node +0 -0
- package/dist/osx/steamworksjs.darwin-x64.node +0 -0
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2022 Gabriel Francisco Dos Santos
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2022 Gabriel Francisco Dos Santos
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# steamworks.js-timmy
|
|
2
|
-
|
|
3
|
-
package with added features and newer steam API
|
|
4
|
-
|
|
5
|
-
yum
|
|
6
|
-
|
|
7
|
-
specifically tailored for [NEODITRONIX](https://store.steampowered.com/app/3782120/NEODITRONIX/), please play it!!!!
|
|
1
|
+
# steamworks.js-timmy
|
|
2
|
+
|
|
3
|
+
package with added features and newer steam API
|
|
4
|
+
|
|
5
|
+
yum
|
|
6
|
+
|
|
7
|
+
specifically tailored for [NEODITRONIX](https://store.steampowered.com/app/3782120/NEODITRONIX/), please play it!!!!
|
package/callbacks.d.ts
CHANGED
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
import client = require('./client')
|
|
2
|
-
|
|
3
|
-
export const enum ChatMemberStateChange {
|
|
4
|
-
/** This user has joined or is joining the lobby. */
|
|
5
|
-
Entered,
|
|
6
|
-
/** This user has left or is leaving the lobby. */
|
|
7
|
-
Left,
|
|
8
|
-
/** User disconnected without leaving the lobby first. */
|
|
9
|
-
Disconnected,
|
|
10
|
-
/** The user has been kicked. */
|
|
11
|
-
Kicked,
|
|
12
|
-
/** The user has been kicked and banned. */
|
|
13
|
-
Banned,
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface CallbackReturns {
|
|
17
|
-
[client.callback.SteamCallback.PersonaStateChange]: {
|
|
18
|
-
steam_id: bigint
|
|
19
|
-
flags: { bits: number }
|
|
20
|
-
}
|
|
21
|
-
[client.callback.SteamCallback.SteamServersConnected]: {}
|
|
22
|
-
[client.callback.SteamCallback.SteamServersDisconnected]: {
|
|
23
|
-
reason: number
|
|
24
|
-
}
|
|
25
|
-
[client.callback.SteamCallback.SteamServerConnectFailure]: {
|
|
26
|
-
reason: number
|
|
27
|
-
still_retrying: boolean
|
|
28
|
-
}
|
|
29
|
-
[client.callback.SteamCallback.LobbyDataUpdate]: {
|
|
30
|
-
lobby: bigint
|
|
31
|
-
member: bigint
|
|
32
|
-
success: boolean
|
|
33
|
-
}
|
|
34
|
-
[client.callback.SteamCallback.LobbyChatUpdate]: {
|
|
35
|
-
lobby: bigint
|
|
36
|
-
user_changed: bigint
|
|
37
|
-
making_change: bigint
|
|
38
|
-
member_state_change: ChatMemberStateChange
|
|
39
|
-
}
|
|
40
|
-
[client.callback.SteamCallback.P2PSessionRequest]: {
|
|
41
|
-
remote: bigint
|
|
42
|
-
}
|
|
43
|
-
[client.callback.SteamCallback.P2PSessionConnectFail]: {
|
|
44
|
-
remote: bigint
|
|
45
|
-
error: number
|
|
46
|
-
}
|
|
47
|
-
[client.callback.SteamCallback.GameLobbyJoinRequested]: {
|
|
48
|
-
lobby_steam_id: bigint
|
|
49
|
-
friend_steam_id: bigint
|
|
50
|
-
}
|
|
51
|
-
[client.callback.SteamCallback.MicroTxnAuthorizationResponse]: {
|
|
52
|
-
app_id: number
|
|
53
|
-
order_id: number | bigint
|
|
54
|
-
authorized: boolean
|
|
55
|
-
}
|
|
56
|
-
}
|
|
1
|
+
import client = require('./client')
|
|
2
|
+
|
|
3
|
+
export const enum ChatMemberStateChange {
|
|
4
|
+
/** This user has joined or is joining the lobby. */
|
|
5
|
+
Entered,
|
|
6
|
+
/** This user has left or is leaving the lobby. */
|
|
7
|
+
Left,
|
|
8
|
+
/** User disconnected without leaving the lobby first. */
|
|
9
|
+
Disconnected,
|
|
10
|
+
/** The user has been kicked. */
|
|
11
|
+
Kicked,
|
|
12
|
+
/** The user has been kicked and banned. */
|
|
13
|
+
Banned,
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface CallbackReturns {
|
|
17
|
+
[client.callback.SteamCallback.PersonaStateChange]: {
|
|
18
|
+
steam_id: bigint
|
|
19
|
+
flags: { bits: number }
|
|
20
|
+
}
|
|
21
|
+
[client.callback.SteamCallback.SteamServersConnected]: {}
|
|
22
|
+
[client.callback.SteamCallback.SteamServersDisconnected]: {
|
|
23
|
+
reason: number
|
|
24
|
+
}
|
|
25
|
+
[client.callback.SteamCallback.SteamServerConnectFailure]: {
|
|
26
|
+
reason: number
|
|
27
|
+
still_retrying: boolean
|
|
28
|
+
}
|
|
29
|
+
[client.callback.SteamCallback.LobbyDataUpdate]: {
|
|
30
|
+
lobby: bigint
|
|
31
|
+
member: bigint
|
|
32
|
+
success: boolean
|
|
33
|
+
}
|
|
34
|
+
[client.callback.SteamCallback.LobbyChatUpdate]: {
|
|
35
|
+
lobby: bigint
|
|
36
|
+
user_changed: bigint
|
|
37
|
+
making_change: bigint
|
|
38
|
+
member_state_change: ChatMemberStateChange
|
|
39
|
+
}
|
|
40
|
+
[client.callback.SteamCallback.P2PSessionRequest]: {
|
|
41
|
+
remote: bigint
|
|
42
|
+
}
|
|
43
|
+
[client.callback.SteamCallback.P2PSessionConnectFail]: {
|
|
44
|
+
remote: bigint
|
|
45
|
+
error: number
|
|
46
|
+
}
|
|
47
|
+
[client.callback.SteamCallback.GameLobbyJoinRequested]: {
|
|
48
|
+
lobby_steam_id: bigint
|
|
49
|
+
friend_steam_id: bigint
|
|
50
|
+
}
|
|
51
|
+
[client.callback.SteamCallback.MicroTxnAuthorizationResponse]: {
|
|
52
|
+
app_id: number
|
|
53
|
+
order_id: number | bigint
|
|
54
|
+
authorized: boolean
|
|
55
|
+
}
|
|
56
|
+
}
|
package/dist/win64/index.js
CHANGED
|
@@ -31,7 +31,10 @@ module.exports.init = (appId) => {
|
|
|
31
31
|
internalInit(appId)
|
|
32
32
|
|
|
33
33
|
clearInterval(runCallbacksInterval)
|
|
34
|
-
runCallbacksInterval = setInterval(
|
|
34
|
+
runCallbacksInterval = setInterval(() => {
|
|
35
|
+
// console.log("Running callbacks")
|
|
36
|
+
runCallbacks()
|
|
37
|
+
}, 1000 / 120)
|
|
35
38
|
|
|
36
39
|
return api
|
|
37
40
|
}
|
|
Binary file
|
package/index.js
CHANGED
|
@@ -1,86 +1,89 @@
|
|
|
1
|
-
const { platform, arch } = process
|
|
2
|
-
|
|
3
|
-
/** @typedef {typeof import('./client.d')} Client */
|
|
4
|
-
/** @type {Client} */
|
|
5
|
-
let nativeBinding = undefined
|
|
6
|
-
|
|
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')
|
|
16
|
-
}
|
|
17
|
-
} else {
|
|
18
|
-
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
let runCallbacksInterval = undefined
|
|
22
|
-
|
|
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
|
|
30
|
-
|
|
31
|
-
internalInit(appId)
|
|
32
|
-
|
|
33
|
-
clearInterval(runCallbacksInterval)
|
|
34
|
-
runCallbacksInterval = setInterval(
|
|
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
|
-
|
|
1
|
+
const { platform, arch } = process
|
|
2
|
+
|
|
3
|
+
/** @typedef {typeof import('./client.d')} Client */
|
|
4
|
+
/** @type {Client} */
|
|
5
|
+
let nativeBinding = undefined
|
|
6
|
+
|
|
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')
|
|
16
|
+
}
|
|
17
|
+
} else {
|
|
18
|
+
throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
let runCallbacksInterval = undefined
|
|
22
|
+
|
|
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
|
|
30
|
+
|
|
31
|
+
internalInit(appId)
|
|
32
|
+
|
|
33
|
+
clearInterval(runCallbacksInterval)
|
|
34
|
+
runCallbacksInterval = setInterval(() => {
|
|
35
|
+
// console.log("Running callbacks")
|
|
36
|
+
runCallbacks()
|
|
37
|
+
}, 1000 / 120)
|
|
38
|
+
|
|
39
|
+
return api
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description Shuts down the steam client
|
|
44
|
+
*/
|
|
45
|
+
module.exports.shutdown = () => {
|
|
46
|
+
clearInterval(runCallbacksInterval)
|
|
47
|
+
nativeBinding.shutdownClient()
|
|
48
|
+
runCallbacksInterval = undefined
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @param {number} appId - App ID of the game to load
|
|
53
|
+
* {@link https://partner.steamgames.com/doc/api/steam_api#SteamAPI_RestartAppIfNecessary}
|
|
54
|
+
* @returns {boolean}
|
|
55
|
+
*/
|
|
56
|
+
module.exports.restartAppIfNecessary = (appId) => nativeBinding.restartAppIfNecessary(appId);
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Enable the steam overlay on electron
|
|
60
|
+
* @param {boolean} [disableEachFrameInvalidation] - Should attach a single pixel to be rendered each frame
|
|
61
|
+
*/
|
|
62
|
+
module.exports.electronEnableSteamOverlay = (disableEachFrameInvalidation) => {
|
|
63
|
+
const electron = require('electron')
|
|
64
|
+
if (!electron) {
|
|
65
|
+
throw new Error('Electron module not found')
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
electron.app.commandLine.appendSwitch('in-process-gpu')
|
|
69
|
+
electron.app.commandLine.appendSwitch('disable-direct-composition')
|
|
70
|
+
|
|
71
|
+
if (!disableEachFrameInvalidation) {
|
|
72
|
+
/** @param {electron.BrowserWindow} browserWindow */
|
|
73
|
+
const attachFrameInvalidator = (browserWindow) => {
|
|
74
|
+
browserWindow.steamworksRepaintInterval = setInterval(() => {
|
|
75
|
+
if (browserWindow.isDestroyed()) {
|
|
76
|
+
clearInterval(browserWindow.steamworksRepaintInterval)
|
|
77
|
+
} else if (!browserWindow.webContents.isPainting()) {
|
|
78
|
+
browserWindow.webContents.invalidate()
|
|
79
|
+
}
|
|
80
|
+
}, 1000 / 60)
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
electron.BrowserWindow.getAllWindows().forEach(attachFrameInvalidator)
|
|
84
|
+
electron.app.on('browser-window-created', (_, bw) => attachFrameInvalidator(bw))
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const SteamCallback = nativeBinding.callback.SteamCallback
|
|
86
89
|
module.exports.SteamCallback = SteamCallback
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "steamworks.js-timmy",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -23,18 +23,17 @@
|
|
|
23
23
|
"license": "MIT",
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@napi-rs/cli": "3.3.1",
|
|
26
|
+
"@types/node": "*",
|
|
26
27
|
"electron": "24.2.0",
|
|
27
28
|
"rimraf": "6.0.1",
|
|
28
29
|
"typescript": "5.5.3"
|
|
29
30
|
},
|
|
30
|
-
"dependencies": {
|
|
31
|
-
"@types/node": "*"
|
|
32
|
-
},
|
|
33
31
|
"engines": {
|
|
34
32
|
"node": ">= 14"
|
|
35
33
|
},
|
|
36
34
|
"scripts": {
|
|
37
35
|
"build": "npm run types && node build --release",
|
|
36
|
+
"prepare": "npm run build",
|
|
38
37
|
"build:debug": "node build",
|
|
39
38
|
"prune": "rimraf dist target client.d.ts",
|
|
40
39
|
"format": "cargo clippy --fix --allow-staged && cargo fmt",
|