steamworks-ffi-node 0.5.3 โ†’ 0.6.1

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.
Files changed (65) hide show
  1. package/README.md +98 -55
  2. package/dist/index.d.ts +2 -0
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +5 -1
  5. package/dist/index.js.map +1 -1
  6. package/dist/internal/SteamAPICore.d.ts +23 -0
  7. package/dist/internal/SteamAPICore.d.ts.map +1 -1
  8. package/dist/internal/SteamAPICore.js +30 -0
  9. package/dist/internal/SteamAPICore.js.map +1 -1
  10. package/dist/internal/SteamCallbackPoller.d.ts +72 -0
  11. package/dist/internal/SteamCallbackPoller.d.ts.map +1 -1
  12. package/dist/internal/SteamCallbackPoller.js +144 -2
  13. package/dist/internal/SteamCallbackPoller.js.map +1 -1
  14. package/dist/internal/SteamCloudManager.d.ts.map +1 -1
  15. package/dist/internal/SteamCloudManager.js +18 -18
  16. package/dist/internal/SteamCloudManager.js.map +1 -1
  17. package/dist/internal/SteamLibraryLoader.d.ts +28 -0
  18. package/dist/internal/SteamLibraryLoader.d.ts.map +1 -1
  19. package/dist/internal/SteamLibraryLoader.js +96 -30
  20. package/dist/internal/SteamLibraryLoader.js.map +1 -1
  21. package/dist/internal/SteamOverlayManager.js +21 -21
  22. package/dist/internal/SteamOverlayManager.js.map +1 -1
  23. package/dist/internal/SteamRichPresenceManager.js +18 -18
  24. package/dist/internal/SteamRichPresenceManager.js.map +1 -1
  25. package/dist/internal/SteamWorkshopManager.d.ts +602 -0
  26. package/dist/internal/SteamWorkshopManager.d.ts.map +1 -0
  27. package/dist/internal/SteamWorkshopManager.js +1426 -0
  28. package/dist/internal/SteamWorkshopManager.js.map +1 -0
  29. package/dist/internal/callbackTypes/SteamCallbackIds.d.ts +26 -0
  30. package/dist/internal/callbackTypes/SteamCallbackIds.d.ts.map +1 -0
  31. package/dist/internal/callbackTypes/SteamCallbackIds.js +35 -0
  32. package/dist/internal/callbackTypes/SteamCallbackIds.js.map +1 -0
  33. package/dist/internal/callbackTypes/SteamCallbackTypes.d.ts +89 -0
  34. package/dist/internal/callbackTypes/SteamCallbackTypes.d.ts.map +1 -0
  35. package/dist/internal/callbackTypes/SteamCallbackTypes.js +9 -0
  36. package/dist/internal/callbackTypes/SteamCallbackTypes.js.map +1 -0
  37. package/dist/internal/callbackTypes/index.d.ts +6 -0
  38. package/dist/internal/callbackTypes/index.d.ts.map +1 -0
  39. package/dist/internal/callbackTypes/index.js +22 -0
  40. package/dist/internal/callbackTypes/index.js.map +1 -0
  41. package/dist/steam.d.ts +42 -0
  42. package/dist/steam.d.ts.map +1 -1
  43. package/dist/steam.js +4 -0
  44. package/dist/steam.js.map +1 -1
  45. package/dist/types/index.d.ts +2 -0
  46. package/dist/types/index.d.ts.map +1 -1
  47. package/dist/types/index.js +3 -0
  48. package/dist/types/index.js.map +1 -1
  49. package/dist/types/workshop.d.ts +302 -0
  50. package/dist/types/workshop.d.ts.map +1 -0
  51. package/dist/types/workshop.js +203 -0
  52. package/dist/types/workshop.js.map +1 -0
  53. package/docs/README.md +167 -0
  54. package/docs/STEAMWORKS_SDK_SETUP.md +209 -0
  55. package/package.json +9 -3
  56. package/postinstall.js +34 -0
  57. package/verify-sdk-setup.js +220 -0
  58. package/THIRD_PARTY_LICENSES.md +0 -24
  59. package/steamworks_sdk/redistributable_bin/linux32/libsteam_api.so +0 -0
  60. package/steamworks_sdk/redistributable_bin/linux64/libsteam_api.so +0 -0
  61. package/steamworks_sdk/redistributable_bin/osx/libsteam_api.dylib +0 -0
  62. package/steamworks_sdk/redistributable_bin/steam_api.dll +0 -0
  63. package/steamworks_sdk/redistributable_bin/steam_api.lib +0 -0
  64. package/steamworks_sdk/redistributable_bin/win64/steam_api64.dll +0 -0
  65. package/steamworks_sdk/redistributable_bin/win64/steam_api64.lib +0 -0
package/docs/README.md ADDED
@@ -0,0 +1,167 @@
1
+ # Steamworks FFI Documentation
2
+
3
+ Complete API documentation for all Steamworks FFI functionality.
4
+
5
+ ## ๐ŸŽฏ Manager-Based API
6
+
7
+ Steamworks FFI uses a **manager-based architecture** for better organization:
8
+
9
+ ```typescript
10
+ import SteamworksSDK from 'steamworks-ffi-node';
11
+
12
+ const steam = new SteamworksSDK();
13
+ steam.init({ appId: 480 });
14
+
15
+ // Access features through specialized managers
16
+ steam.achievements.* // Achievement operations
17
+ steam.stats.* // Statistics operations
18
+ steam.leaderboards.* // Leaderboard operations
19
+ steam.friends.* // Friends and social operations
20
+ steam.richPresence.* // Rich Presence operations
21
+ steam.overlay.* // Overlay control operations
22
+ steam.cloud.* // Cloud storage operations
23
+ steam.workshop.* // Workshop/UGC operations
24
+ ```
25
+
26
+ This design:
27
+ - โœ… **Groups related functions** - Easy to discover all achievement/stats/leaderboard methods
28
+ - โœ… **Clear namespacing** - No naming conflicts
29
+ - โœ… **Better IDE support** - Autocomplete shows relevant methods
30
+ - โœ… **Logical organization** - Matches Steamworks SDK structure
31
+
32
+ ---
33
+
34
+ ## ๐Ÿ“š Available Documentation
35
+
36
+ ### Core API
37
+ - **[SteamAPICore Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STEAM_API_CORE.md)**
38
+ - Initialization and lifecycle management
39
+ - Steam callbacks and event handling
40
+ - Status checking and diagnostics
41
+ - Platform-specific library loading
42
+
43
+ ### Achievement System
44
+ - **[Achievement Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/ACHIEVEMENT_MANAGER.md)**
45
+ - **20 Functions** - 100% Achievement API coverage
46
+ - Core operations (get, unlock, clear, check status)
47
+ - Visual features (icons, progress notifications)
48
+ - Progress tracking (get limits for progress bars)
49
+ - Friend comparisons (see friend achievements)
50
+ - Global statistics (unlock percentages, popularity sorting)
51
+ - Testing tools (reset stats/achievements)
52
+
53
+ ### Statistics System
54
+ - **[Stats Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)**
55
+ - **14 Functions** - 100% Stats API coverage
56
+ - User stats (get/set int/float, average rate tracking)
57
+ - Friend comparisons (compare stats with friends)
58
+ - Global statistics (worldwide aggregated data with history)
59
+
60
+ ### Leaderboard System
61
+ - **[Leaderboard Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/LEADERBOARD_MANAGER.md)**
62
+ - **7 Functions** - 100% Leaderboard API coverage
63
+ - Leaderboard management (find, create, get info)
64
+ - Score operations (upload with optional details)
65
+ - Entry download (global, friends, specific users)
66
+ - UGC integration (attach replays/screenshots to entries)
67
+
68
+ ### Friends & Social System
69
+ - **[Friends Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)**
70
+ - **22 Functions** - Complete friends and social features
71
+ - Current user info (get persona name, online status)
72
+ - Friends list management (count, iterate, retrieve all)
73
+ - Friend information (names, status, relationship types, Steam levels)
74
+ - Friend activity (check what games friends are playing)
75
+ - Friend avatars (small/medium/large avatar handles)
76
+ - Friend groups (manage and query friend tags/categories)
77
+ - Coplay tracking (recently played with users)
78
+
79
+ ### Rich Presence System
80
+ - **[Rich Presence Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/RICH_PRESENCE_MANAGER.md)**
81
+ - **6 Functions** - Complete Rich Presence support
82
+ - Set/clear rich presence key/value pairs
83
+ - Query friend rich presence data
84
+ - Display custom status in Steam friends list
85
+ - Enable friend join functionality
86
+ - Player groups and localization support
87
+
88
+ ### Overlay System
89
+ - **[Overlay Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/OVERLAY_MANAGER.md)**
90
+ - **7 Functions** - Complete overlay control
91
+ - Open overlay to various dialogs (friends, achievements, etc.)
92
+ - Open overlay to user profiles and stats
93
+ - Open overlay browser to URLs
94
+ - Open store pages with purchase options
95
+ - Show invite dialogs for multiplayer
96
+
97
+ ### Cloud Storage System
98
+ - **[Cloud Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/CLOUD_MANAGER.md)**
99
+ - **14 Functions** - Complete Steam Cloud (Remote Storage) support
100
+ - File operations (write, read, delete, check existence)
101
+ - File metadata (size, timestamp, persistence status)
102
+ - File listing (count, iterate, get all with details)
103
+ - Quota management (track storage usage and limits)
104
+ - Cloud settings (check/toggle cloud sync for account and app)
105
+
106
+ ### Workshop System
107
+ - **[Workshop Manager API](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/WORKSHOP_MANAGER.md)**
108
+ - **25+ Functions** - Complete Steam Workshop/UGC support
109
+ - Subscription management (subscribe, unsubscribe, list items)
110
+ - Item state & information (download progress, installation info)
111
+ - Query operations (search, browse, filter Workshop content)
112
+ - Item creation & update (create, upload, manage your Workshop items)
113
+ - Voting & favorites (vote on items, manage favorites)
114
+
115
+ ## ๐Ÿš€ Quick Links
116
+
117
+ ### Getting Started
118
+ - [Installation Guide](https://github.com/ArtyProf/steamworks-ffi-node#installation)
119
+ - [Quick Start Examples](https://github.com/ArtyProf/steamworks-ffi-node#quick-start)
120
+ - [Electron Integration](https://github.com/ArtyProf/steamworks-ffi-node#electron-integration)
121
+
122
+ ### Testing
123
+
124
+ **JavaScript Tests** (Production - Uses compiled dist/):
125
+ - Run Achievement Tests: `npm run test:achievements:js` - Tests all 20 achievement functions
126
+ - Run Stats Tests: `npm run test:stats:js` - Tests all 14 stats functions
127
+ - Run Leaderboard Tests: `npm run test:leaderboards:js` - Tests all 7 leaderboard functions
128
+ - Run Friends Tests: `npm run test:friends:js` - Tests all 22 friends functions
129
+ - Run Cloud Tests: `npm run test:cloud:js` - Tests all 14 cloud storage functions
130
+ - Run Rich Presence & Overlay Tests: `npm run test:richpresence-overlay:js` - Tests 6 rich presence + 7 overlay functions
131
+ - Run Workshop Tests: `npm run test:workshop:js` - Tests all 25+ Workshop/UGC functions
132
+
133
+ **TypeScript Tests** (Development - Direct src/ imports, no rebuild needed):
134
+ - Run Achievement Tests: `npm run test:achievements:ts` - With type safety โœจ
135
+ - Run Stats Tests: `npm run test:stats:ts` - With type safety โœจ
136
+ - Run Leaderboard Tests: `npm run test:leaderboards:ts` - With type safety โœจ
137
+ - Run Friends Tests: `npm run test:friends:ts` - With type safety โœจ
138
+ - Run Cloud Tests: `npm run test:cloud:ts` - With type safety โœจ
139
+ - Run Rich Presence & Overlay Tests: `npm run test:richpresence-overlay:ts` - With type safety โœจ
140
+ - Run Workshop Tests: `npm run test:workshop:ts` - With type safety โœจ
141
+
142
+ ๐Ÿ“ All tests are in `tests/` folder with separate `js/` and `ts/` subfolders.
143
+
144
+ ๐Ÿ’ก **Pro tip**: TypeScript tests import directly from `src/` so you can test changes immediately without running `npm run build`!
145
+
146
+ ### Additional Resources
147
+ - [GitHub Repository](https://github.com/ArtyProf/steamworks-ffi-node)
148
+ - [NPM Package](https://www.npmjs.com/package/steamworks-ffi-node)
149
+ - [Report Issues](https://github.com/ArtyProf/steamworks-ffi-node/issues)
150
+
151
+ ---
152
+
153
+ ## ๐Ÿ“– Documentation Structure
154
+
155
+ Each API documentation includes:
156
+ - **Overview** - Architecture and design patterns
157
+ - **Quick Reference** - Function categories and counts
158
+ - **Detailed Functions** - Parameters, returns, SDK mappings, examples
159
+ - **Configuration** - Steamworks Partner setup instructions
160
+ - **TypeScript Types** - Interface definitions
161
+ - **Complete Examples** - Real-world usage scenarios
162
+ - **Best Practices** - Guidelines and recommendations
163
+ - **Error Handling** - Common issues and solutions
164
+
165
+ ---
166
+
167
+ **Need help?** Check the [troubleshooting section](https://github.com/ArtyProf/steamworks-ffi-node#troubleshooting) in the main README or [open an issue](https://github.com/ArtyProf/steamworks-ffi-node/issues).
@@ -0,0 +1,209 @@
1
+ # Steamworks SDK Setup Guide
2
+
3
+ This guide explains how to properly set up the Steamworks SDK redistributables for use with steamworks-ffi-node, in compliance with Valve's licensing requirements.
4
+
5
+ ## โš ๏ธ Important Legal Notice
6
+
7
+ **The Steamworks SDK redistributables cannot be bundled with this package due to Valve's licensing terms.** Users must download and install the Steamworks SDK separately from Valve's official source.
8
+
9
+ ## Quick Setup
10
+
11
+ ### 1. Download Steamworks SDK
12
+
13
+ 1. Visit the [Steamworks Partner site](https://partner.steamgames.com/)
14
+ 2. Log in with your Steam account (you need to be a registered Steamworks developer)
15
+ 3. Download the latest Steamworks SDK
16
+ 4. Extract the downloaded archive
17
+
18
+ > **Note**: This package was built and tested with Steamworks SDK v1.62. While newer versions should be compatible, v1.62 or later is recommended for optimal compatibility.
19
+
20
+ ### 2. Install SDK Redistributables
21
+
22
+ Copy the `redistributable_bin` folder from the Steamworks SDK to your project:
23
+
24
+ ```
25
+ your-project/
26
+ โ”œโ”€โ”€ steamworks_sdk/
27
+ โ”‚ โ””โ”€โ”€ redistributable_bin/
28
+ โ”‚ โ”œโ”€โ”€ win64/
29
+ โ”‚ โ”‚ โ””โ”€โ”€ steam_api64.dll
30
+ โ”‚ โ”œโ”€โ”€ steam_api.dll
31
+ โ”‚ โ”œโ”€โ”€ osx/
32
+ โ”‚ โ”‚ โ””โ”€โ”€ libsteam_api.dylib
33
+ โ”‚ โ””โ”€โ”€ linux64/
34
+ โ”‚ โ””โ”€โ”€ libsteam_api.so
35
+ โ”œโ”€โ”€ package.json
36
+ โ””โ”€โ”€ your-app-files...
37
+ ```
38
+
39
+ ### 3. Verify Installation
40
+
41
+ Run this command to verify the SDK is properly installed:
42
+
43
+ ```bash
44
+ npm run verify-sdk
45
+ ```
46
+
47
+ This will check your steamworks_sdk installation and provide detailed feedback about any missing files or configuration issues.
48
+
49
+ ## Detailed Setup Instructions
50
+
51
+ ### For Game Developers
52
+
53
+ 1. **Get Steamworks Access**
54
+ - Register as a Steamworks developer at [partner.steamgames.com](https://partner.steamgames.com/)
55
+ - Complete the registration process and pay the one-time fee if required
56
+
57
+ 2. **Download SDK**
58
+ - Go to the "Downloads" section in Steamworks Partner
59
+ - Download the latest Steamworks SDK (typically a .zip file)
60
+ - Extract the archive to a temporary location
61
+
62
+ 3. **Copy Redistributables**
63
+ - Navigate to the extracted SDK folder
64
+ - Find the `redistributable_bin` directory
65
+ - Copy the entire `redistributable_bin` folder to your project's `steamworks_sdk/` directory
66
+
67
+ ### For Open Source Projects / Contributors
68
+
69
+ If you're contributing to an open source project that uses steamworks-ffi-node:
70
+
71
+ 1. **SDK Access Required**
72
+ - You'll need your own Steamworks developer account to download the SDK
73
+ - The redistributables cannot be shared or bundled due to licensing restrictions
74
+
75
+ 2. **Development Setup**
76
+ - Download the SDK using your own Steamworks account
77
+ - Set up the folder structure as described above
78
+ - Never commit the `steamworks_sdk/` folder to version control
79
+
80
+ 3. **Testing**
81
+ - Use Spacewar (App ID 480) for testing - it's free and available to all developers
82
+ - Either create a `steam_appid.txt` file with content `480` OR pass `480` to `steam.init(480)`
83
+
84
+ ## Supported Platforms and Files
85
+
86
+ ### Windows
87
+ - **64-bit**: `steamworks_sdk/redistributable_bin/win64/steam_api64.dll`
88
+ - **32-bit**: `steamworks_sdk/redistributable_bin/steam_api.dll`
89
+
90
+ ### macOS
91
+ - **Universal**: `steamworks_sdk/redistributable_bin/osx/libsteam_api.dylib`
92
+
93
+ ### Linux
94
+ - **64-bit**: `steamworks_sdk/redistributable_bin/linux64/libsteam_api.so`
95
+
96
+ ## Project Structure Examples
97
+
98
+ ### Basic Node.js Project
99
+ ```
100
+ my-steam-game/
101
+ โ”œโ”€โ”€ steamworks_sdk/
102
+ โ”‚ โ””โ”€โ”€ redistributable_bin/
103
+ โ”‚ โ”œโ”€โ”€ win64/steam_api64.dll
104
+ โ”‚ โ”œโ”€โ”€ steam_api.dll
105
+ โ”‚ โ”œโ”€โ”€ osx/libsteam_api.dylib
106
+ โ”‚ โ””โ”€โ”€ linux64/libsteam_api.so
107
+ โ”œโ”€โ”€ package.json
108
+ โ”œโ”€โ”€ steam_appid.txt
109
+ โ””โ”€โ”€ src/
110
+ โ””โ”€โ”€ main.js
111
+ ```
112
+
113
+ ### Electron Application
114
+ ```
115
+ my-electron-app/
116
+ โ”œโ”€โ”€ steamworks_sdk/
117
+ โ”‚ โ””โ”€โ”€ redistributable_bin/
118
+ โ”‚ โ””โ”€โ”€ [platform files...]
119
+ โ”œโ”€โ”€ package.json
120
+ โ”œโ”€โ”€ steam_appid.txt
121
+ โ”œโ”€โ”€ src/
122
+ โ”‚ โ”œโ”€โ”€ main.js
123
+ โ”‚ โ””โ”€โ”€ renderer.js
124
+ โ””โ”€โ”€ dist/
125
+ โ””โ”€โ”€ [built app...]
126
+ ```
127
+
128
+ ### Monorepo Setup
129
+ ```
130
+ my-monorepo/
131
+ โ”œโ”€โ”€ steamworks_sdk/
132
+ โ”‚ โ””โ”€โ”€ redistributable_bin/
133
+ โ”‚ โ””โ”€โ”€ [platform files...]
134
+ โ”œโ”€โ”€ packages/
135
+ โ”‚ โ”œโ”€โ”€ game-client/
136
+ โ”‚ โ”‚ โ”œโ”€โ”€ package.json
137
+ โ”‚ โ”‚ โ””โ”€โ”€ src/
138
+ โ”‚ โ””โ”€โ”€ game-server/
139
+ โ”‚ โ”œโ”€โ”€ package.json
140
+ โ”‚ โ””โ”€โ”€ src/
141
+ โ””โ”€โ”€ steam_appid.txt
142
+ ```
143
+
144
+ ## Troubleshooting
145
+
146
+ ### "Steamworks SDK library not found" Error
147
+
148
+ This error means the redistributables are not properly installed. Check:
149
+
150
+ 1. โœ… The `steamworks_sdk/redistributable_bin` folder exists in your project root
151
+ 2. โœ… Platform-specific libraries are in the correct subfolders
152
+ 3. โœ… File permissions allow reading the library files
153
+ 4. โœ… You're running from the correct working directory
154
+
155
+ ### "Cannot find function 'SteamAPI_Init'" Error
156
+
157
+ This usually indicates:
158
+ - Wrong library architecture (32-bit vs 64-bit)
159
+ - Corrupted or incomplete SDK download
160
+ - Incompatible SDK version
161
+
162
+ **Solution**: Re-download the latest Steamworks SDK and replace the redistributables.
163
+
164
+ ### Permission Issues (macOS/Linux)
165
+
166
+ If you get permission errors:
167
+ ```bash
168
+ # Make library executable
169
+ chmod +x steamworks_sdk/redistributable_bin/osx/libsteam_api.dylib
170
+ chmod +x steamworks_sdk/redistributable_bin/linux64/libsteam_api.so
171
+ ```
172
+
173
+ ## Version Compatibility
174
+
175
+ - **steamworks-ffi-node v0.5.x**: Compatible with Steamworks SDK v1.58+
176
+ - **Always use the latest** Steamworks SDK from Valve for best compatibility
177
+ - **Check release notes** for any breaking changes in new SDK versions
178
+
179
+ ## Legal Compliance
180
+
181
+ ### โœ… Allowed
182
+ - Downloading SDK with your own Steamworks developer account
183
+ - Using redistributables in your own games
184
+ - Distributing your game with embedded redistributables
185
+
186
+ ### โŒ Not Allowed
187
+ - Redistributing SDK files in npm packages
188
+ - Sharing SDK files with non-developers
189
+ - Using SDK without proper Steamworks registration
190
+
191
+ ### ๐Ÿ“‹ Requirements for Distribution
192
+ - Register as Steamworks developer
193
+ - Agree to Steamworks SDK license
194
+ - Include redistributables only with your shipped game
195
+
196
+ ## Support
197
+
198
+ If you encounter issues:
199
+
200
+ 1. **Check this guide** for common solutions
201
+ 2. **Verify SDK installation** using the verification script above
202
+ 3. **Update to latest SDK** from Valve
203
+ 4. **Open an issue** at [steamworks-ffi-node GitHub](https://github.com/ArtyProf/steamworks-ffi-node/issues)
204
+
205
+ For Steamworks SDK licensing questions, contact Valve directly through the Steamworks Partner portal.
206
+
207
+ ---
208
+
209
+ **Note**: This package is not affiliated with Valve Corporation. Steamworks is a trademark of Valve Corporation.
package/package.json CHANGED
@@ -1,22 +1,27 @@
1
1
  {
2
2
  "name": "steamworks-ffi-node",
3
- "version": "0.5.3",
3
+ "version": "0.6.1",
4
4
  "description": "Steamworks SDK wrapper using FFI for Node.js/Electron - Full Steam Integration",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "scripts": {
8
8
  "build": "tsc",
9
+ "postinstall": "node postinstall.js",
10
+ "verify-sdk": "node verify-sdk-setup.js",
11
+ "test:discord": "node test-discord-integration.js",
9
12
  "test:achievements:js": "node tests/js/test-complete-achievements.js",
10
13
  "test:stats:js": "node tests/js/test-complete-stats.js",
11
14
  "test:leaderboards:js": "node tests/js/test-complete-leaderboards.js",
12
15
  "test:friends:js": "node tests/js/test-complete-friends.js",
13
16
  "test:cloud:js": "node tests/js/test-complete-cloud.js",
17
+ "test:workshop:js": "node tests/js/test-workshop.js",
14
18
  "test:richpresence-overlay:js": "node tests/js/test-richpresence-overlay.js",
15
19
  "test:achievements:ts": "ts-node tests/ts/test-complete-achievements.ts",
16
20
  "test:stats:ts": "ts-node tests/ts/test-complete-stats.ts",
17
21
  "test:leaderboards:ts": "ts-node tests/ts/test-complete-leaderboards.ts",
18
22
  "test:friends:ts": "ts-node tests/ts/test-complete-friends.ts",
19
23
  "test:cloud:ts": "ts-node tests/ts/test-complete-cloud.ts",
24
+ "test:workshop:ts": "ts-node tests/ts/test-workshop.ts",
20
25
  "test:richpresence-overlay:ts": "ts-node tests/ts/test-richpresence-overlay.ts",
21
26
  "prepublishOnly": "npm run build"
22
27
  },
@@ -30,10 +35,11 @@
30
35
  },
31
36
  "files": [
32
37
  "dist/**/*",
33
- "steamworks_sdk/redistributable_bin/**/*",
34
38
  "README.md",
35
39
  "LICENSE",
36
- "THIRD_PARTY_LICENSES.md"
40
+ "docs/STEAMWORKS_SDK_SETUP.md",
41
+ "verify-sdk-setup.js",
42
+ "postinstall.js"
37
43
  ],
38
44
  "keywords": [
39
45
  "steam",
package/postinstall.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Post-installation script for steamworks-ffi-node
5
+ *
6
+ * This script provides guidance to users after package installation
7
+ * about setting up the Steamworks SDK redistributables.
8
+ */
9
+
10
+ console.log('');
11
+ console.log('๐ŸŽ‰ steamworks-ffi-node installed successfully!');
12
+ console.log('');
13
+ console.log('๐Ÿ“‹ Next Steps:');
14
+ console.log('==============');
15
+ console.log('');
16
+ console.log('1. ๐Ÿ“ฅ Download Steamworks SDK redistributables');
17
+ console.log(' - Get them from: https://partner.steamgames.com/');
18
+ console.log(' - Extract and copy "redistributable_bin" to "steamworks_sdk/" in your project');
19
+ console.log('');
20
+ console.log('2. ๐Ÿ”ง Configure your Steam App ID');
21
+ console.log(' - Option A: Create steam_appid.txt with your App ID');
22
+ console.log(' - Option B: Pass App ID to steam.init(yourAppId)');
23
+ console.log(' - For testing: Use App ID 480 (Spacewar)');
24
+ console.log('');
25
+ console.log('3. โœ… Verify setup');
26
+ console.log(' Run: npm run verify-sdk');
27
+ console.log('');
28
+ console.log('๐Ÿ“– Complete setup guide:');
29
+ console.log('https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STEAMWORKS_SDK_SETUP.md');
30
+ console.log('');
31
+ console.log('โš ๏ธ Legal Notice:');
32
+ console.log('Due to Valve\'s licensing terms, the Steamworks SDK redistributables');
33
+ console.log('cannot be bundled with this package and must be downloaded separately.');
34
+ console.log('');
@@ -0,0 +1,220 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Steamworks SDK Installation Verification Script
5
+ *
6
+ * This script checks if the Steamworks SDK redistributables are properly installed
7
+ * and provides helpful guidance if they're missing.
8
+ */
9
+
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+
13
+ function checkSteamworksSDK() {
14
+ console.log('๐Ÿ” Steamworks SDK Installation Verification');
15
+ console.log('===========================================');
16
+ console.log('');
17
+
18
+ const possibleBasePaths = [
19
+ process.cwd(),
20
+ path.resolve(process.cwd(), '..'),
21
+ path.resolve(process.cwd(), '../..'),
22
+ ];
23
+
24
+ let foundSdk = false;
25
+ let sdkPath = '';
26
+
27
+ // Check for steamworks_sdk folder
28
+ for (const basePath of possibleBasePaths) {
29
+ const checkPath = path.join(basePath, 'steamworks_sdk', 'redistributable_bin');
30
+ if (fs.existsSync(checkPath)) {
31
+ foundSdk = true;
32
+ sdkPath = checkPath;
33
+ console.log(`โœ… Found steamworks_sdk at: ${checkPath}`);
34
+ break;
35
+ }
36
+ }
37
+
38
+ if (!foundSdk) {
39
+ console.log('โŒ Steamworks SDK not found!');
40
+ console.log('');
41
+ console.log('Expected folder structure:');
42
+ console.log(' steamworks_sdk/');
43
+ console.log(' โ””โ”€โ”€ redistributable_bin/');
44
+ console.log(' โ”œโ”€โ”€ win64/steam_api64.dll');
45
+ console.log(' โ”œโ”€โ”€ steam_api.dll');
46
+ console.log(' โ”œโ”€โ”€ osx/libsteam_api.dylib');
47
+ console.log(' โ””โ”€โ”€ linux64/libsteam_api.so');
48
+ console.log('');
49
+ console.log('๐Ÿ“– Setup Instructions:');
50
+ console.log('1. Download Steamworks SDK from: https://partner.steamgames.com/');
51
+ console.log('2. Extract the SDK archive');
52
+ console.log('3. Copy the "redistributable_bin" folder to "steamworks_sdk/" in your project');
53
+ console.log('4. See https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STEAMWORKS_SDK_SETUP.md for detailed instructions');
54
+ console.log('');
55
+ console.log('Searched paths:');
56
+ possibleBasePaths.forEach(p => {
57
+ console.log(` - ${path.join(p, 'steamworks_sdk', 'redistributable_bin')}`);
58
+ });
59
+ return false;
60
+ }
61
+
62
+ // Check platform-specific files
63
+ console.log('');
64
+ console.log('๐Ÿ” Checking platform-specific libraries...');
65
+
66
+ const requiredFiles = [
67
+ { path: 'win64/steam_api64.dll', platform: 'Windows 64-bit' },
68
+ { path: 'steam_api.dll', platform: 'Windows 32-bit' },
69
+ { path: 'osx/libsteam_api.dylib', platform: 'macOS' },
70
+ { path: 'linux64/libsteam_api.so', platform: 'Linux 64-bit' }
71
+ ];
72
+
73
+ let allFilesPresent = true;
74
+ let currentPlatformFileExists = false;
75
+ const currentPlatform = process.platform;
76
+ const currentArch = process.arch;
77
+
78
+ requiredFiles.forEach(file => {
79
+ const filePath = path.join(sdkPath, file.path);
80
+ const exists = fs.existsSync(filePath);
81
+
82
+ console.log(` ${exists ? 'โœ…' : 'โŒ'} ${file.platform}: ${file.path}`);
83
+
84
+ if (!exists) {
85
+ allFilesPresent = false;
86
+ }
87
+
88
+ // Check if current platform file exists
89
+ if (currentPlatform === 'win32' && currentArch === 'x64' && file.path === 'win64/steam_api64.dll' && exists) {
90
+ currentPlatformFileExists = true;
91
+ } else if (currentPlatform === 'win32' && currentArch !== 'x64' && file.path === 'steam_api.dll' && exists) {
92
+ currentPlatformFileExists = true;
93
+ } else if (currentPlatform === 'darwin' && file.path === 'osx/libsteam_api.dylib' && exists) {
94
+ currentPlatformFileExists = true;
95
+ } else if (currentPlatform === 'linux' && file.path === 'linux64/libsteam_api.so' && exists) {
96
+ currentPlatformFileExists = true;
97
+ }
98
+ });
99
+
100
+ console.log('');
101
+
102
+ // Check steam_appid.txt (optional)
103
+ const steamAppIdPath = path.join(process.cwd(), 'steam_appid.txt');
104
+ const hasAppId = fs.existsSync(steamAppIdPath);
105
+
106
+ console.log('๐Ÿ” Checking steam_appid.txt (optional)...');
107
+ if (hasAppId) {
108
+ const appId = fs.readFileSync(steamAppIdPath, 'utf8').trim();
109
+ console.log(`โœ… steam_appid.txt found with App ID: ${appId}`);
110
+ if (appId === '480') {
111
+ console.log(' Note: Using Spacewar (480) - perfect for testing!');
112
+ }
113
+ } else {
114
+ console.log('โ„น๏ธ steam_appid.txt not found (this is optional)');
115
+ console.log(' You can either create this file OR pass the App ID to steam.init(appId)');
116
+ }
117
+
118
+ console.log('');
119
+ console.log('๐Ÿ“Š Summary');
120
+ console.log('==========');
121
+
122
+ if (foundSdk && currentPlatformFileExists) {
123
+ console.log('๐ŸŽ‰ Great! Your Steamworks SDK setup is ready.');
124
+ console.log('');
125
+ console.log('โœ… Steamworks SDK redistributables installed');
126
+ console.log(`โœ… ${getCurrentPlatformName()} library available`);
127
+ if (hasAppId) {
128
+ console.log('โœ… steam_appid.txt configured');
129
+ } else {
130
+ console.log('โ„น๏ธ steam_appid.txt not found (pass App ID to steam.init() instead)');
131
+ }
132
+ console.log('');
133
+ console.log('You can now use steamworks-ffi-node in your project!');
134
+ console.log('');
135
+ console.log('Next steps:');
136
+ console.log('1. Make sure Steam client is running');
137
+ console.log('2. Import steamworks-ffi-node in your code');
138
+ if (hasAppId) {
139
+ console.log('3. Initialize the SDK with steam.init()');
140
+ } else {
141
+ console.log('3. Initialize the SDK with steam.init(yourAppId) or create steam_appid.txt');
142
+ }
143
+ return true;
144
+ } else {
145
+ console.log('โš ๏ธ Setup incomplete. Please address the issues above.');
146
+ console.log('');
147
+
148
+ if (!foundSdk) {
149
+ console.log('โŒ Steamworks SDK redistributables missing');
150
+ } else if (!currentPlatformFileExists) {
151
+ console.log(`โŒ Library for ${getCurrentPlatformName()} missing`);
152
+ }
153
+
154
+ console.log('');
155
+ console.log('๐Ÿ“– See https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STEAMWORKS_SDK_SETUP.md for detailed setup instructions');
156
+ return false;
157
+ }
158
+ }
159
+
160
+ function getCurrentPlatformName() {
161
+ const platform = process.platform;
162
+ const arch = process.arch;
163
+
164
+ if (platform === 'win32') {
165
+ return arch === 'x64' ? 'Windows 64-bit' : 'Windows 32-bit';
166
+ } else if (platform === 'darwin') {
167
+ return 'macOS';
168
+ } else if (platform === 'linux') {
169
+ return 'Linux 64-bit';
170
+ } else {
171
+ return `${platform} (${arch})`;
172
+ }
173
+ }
174
+
175
+ // Test basic functionality if SDK is installed
176
+ function testBasicFunctionality() {
177
+ console.log('');
178
+ console.log('๐Ÿงช Testing Basic Functionality');
179
+ console.log('===============================');
180
+
181
+ try {
182
+ console.log('Attempting to load steamworks-ffi-node...');
183
+
184
+ // Try to require the package
185
+ const SteamworksSDK = require('./dist/index.js').default || require('./dist/index.js');
186
+ console.log('โœ… Package loaded successfully');
187
+
188
+ // Try to create instance (this will test SDK loading)
189
+ console.log('Testing SDK initialization...');
190
+ const steam = new SteamworksSDK();
191
+ console.log('โœ… SteamworksSDK instance created');
192
+
193
+ console.log('');
194
+ console.log('๐ŸŽ‰ Basic functionality test passed!');
195
+ console.log('Your setup appears to be working correctly.');
196
+
197
+ } catch (error) {
198
+ console.log('โŒ Basic functionality test failed');
199
+ console.log(`Error: ${error.message}`);
200
+ console.log('');
201
+ console.log('This could indicate:');
202
+ console.log('- Package not built (run "npm run build")');
203
+ console.log('- Missing dependencies');
204
+ console.log('- Incorrect SDK installation');
205
+ }
206
+ }
207
+
208
+ // Main execution
209
+ if (require.main === module) {
210
+ const success = checkSteamworksSDK();
211
+
212
+ if (success) {
213
+ testBasicFunctionality();
214
+ }
215
+
216
+ console.log('');
217
+ console.log('For more help, visit: https://github.com/ArtyProf/steamworks-ffi-node');
218
+ }
219
+
220
+ module.exports = { checkSteamworksSDK };