steamworks-ffi-node 0.5.1 → 0.5.3
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/README.md +79 -6
- package/dist/internal/SteamAPICore.d.ts +23 -0
- package/dist/internal/SteamAPICore.d.ts.map +1 -1
- package/dist/internal/SteamAPICore.js +30 -0
- package/dist/internal/SteamAPICore.js.map +1 -1
- package/dist/internal/SteamCloudManager.d.ts +319 -0
- package/dist/internal/SteamCloudManager.d.ts.map +1 -0
- package/dist/internal/SteamCloudManager.js +584 -0
- package/dist/internal/SteamCloudManager.js.map +1 -0
- package/dist/internal/SteamFriendsManager.d.ts +368 -1
- package/dist/internal/SteamFriendsManager.d.ts.map +1 -1
- package/dist/internal/SteamFriendsManager.js +601 -0
- package/dist/internal/SteamFriendsManager.js.map +1 -1
- package/dist/internal/SteamLibraryLoader.d.ts +26 -0
- package/dist/internal/SteamLibraryLoader.d.ts.map +1 -1
- package/dist/internal/SteamLibraryLoader.js +36 -0
- package/dist/internal/SteamLibraryLoader.js.map +1 -1
- package/dist/steam.d.ts +36 -0
- package/dist/steam.d.ts.map +1 -1
- package/dist/steam.js +4 -0
- package/dist/steam.js.map +1 -1
- package/dist/types/cloud.d.ts +83 -0
- package/dist/types/cloud.d.ts.map +1 -0
- package/dist/types/cloud.js +35 -0
- package/dist/types/cloud.js.map +1 -0
- package/dist/types/friends.d.ts +16 -0
- package/dist/types/friends.d.ts.map +1 -1
- package/dist/types/friends.js +5 -1
- package/dist/types/friends.js.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -3,22 +3,26 @@
|
|
|
3
3
|
|
|
4
4
|
# Steamworks FFI - Steamworks SDK Integration
|
|
5
5
|
|
|
6
|
-
A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Koffi FFI, designed for Node.js and Electron applications with **Steamworks SDK integration**.
|
|
6
|
+
A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Koffi FFI, designed for Node.js and Electron applications with **Steamworks SDK v1.62 integration**.
|
|
7
7
|
|
|
8
8
|
> ✅ **No C++ Compilation Required**: Uses Koffi FFI for seamless installation without Visual Studio Build Tools!
|
|
9
9
|
|
|
10
|
+
> ⚡ **Latest Steamworks SDK**: Built with Steamworks SDK v1.62 - includes all latest Steam features and improvements!
|
|
11
|
+
|
|
10
12
|
> 🎉 **NEW: 100% Achievement API Coverage** - All 20 Steam achievement functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/ACHIEVEMENT_MANAGER.md)
|
|
11
13
|
|
|
12
14
|
> 🎉 **NEW: 100% Stats API Coverage** - All 14 Steam statistics functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)
|
|
13
15
|
|
|
14
16
|
> 🎉 **NEW: 100% Leaderboard API Coverage** - All 7 Steam leaderboard functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/LEADERBOARD_MANAGER.md)
|
|
15
17
|
|
|
16
|
-
> 🎉 **NEW: Friends API** -
|
|
18
|
+
> 🎉 **NEW: Friends API** - 22 complete Steam friends and social functions implemented! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)
|
|
17
19
|
|
|
18
20
|
> 🎉 **NEW: Rich Presence API** - 6 functions for custom status display and friend join functionality! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/RICH_PRESENCE_MANAGER.md)
|
|
19
21
|
|
|
20
22
|
> 🎉 **NEW: Overlay API** - 7 functions for complete Steam overlay control! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/OVERLAY_MANAGER.md)
|
|
21
23
|
|
|
24
|
+
> 🎉 **NEW: Cloud Storage API** - 14 functions for complete Steam Cloud (Remote Storage) integration! [See Documentation](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/CLOUD_MANAGER.md)
|
|
25
|
+
|
|
22
26
|
## 🎯 Features
|
|
23
27
|
|
|
24
28
|
- **Complete Achievement API**: 100% coverage of Steam Achievement functionality (20/20 functions)
|
|
@@ -37,11 +41,14 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
|
|
|
37
41
|
- ✅ Score operations (upload with optional details)
|
|
38
42
|
- ✅ Entry download (global, friends, specific users)
|
|
39
43
|
- ✅ UGC integration (attach replays/screenshots to entries)
|
|
40
|
-
- **Friends & Social API**:
|
|
44
|
+
- **Friends & Social API**: Complete Steam friends and social features (22 functions)
|
|
41
45
|
- ✅ Current user info (persona name, online state)
|
|
42
46
|
- ✅ Friends list management (count, iterate, get all friends)
|
|
43
47
|
- ✅ Friend information (names, states, relationships, Steam levels)
|
|
44
48
|
- ✅ Friend activity (check games being played)
|
|
49
|
+
- ✅ Friend avatars (small/medium/large avatar handles)
|
|
50
|
+
- ✅ Friend groups (tags/categories management)
|
|
51
|
+
- ✅ Coplay tracking (recently played with users)
|
|
45
52
|
- **Rich Presence API**: Complete Rich Presence support (6 functions)
|
|
46
53
|
- ✅ Set/clear rich presence key/value pairs
|
|
47
54
|
- ✅ Query friend rich presence data
|
|
@@ -53,6 +60,12 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
|
|
|
53
60
|
- ✅ Open overlay web browser to URLs
|
|
54
61
|
- ✅ Open store pages with purchase options
|
|
55
62
|
- ✅ Show invite dialogs for multiplayer sessions
|
|
63
|
+
- **Cloud Storage API**: Complete Steam Cloud (Remote Storage) integration (14 functions)
|
|
64
|
+
- ✅ File operations (write, read, delete, check existence)
|
|
65
|
+
- ✅ File metadata (size, timestamp, persistence status)
|
|
66
|
+
- ✅ File listing (count, iterate, get all with details)
|
|
67
|
+
- ✅ Quota management (track storage usage and limits)
|
|
68
|
+
- ✅ Cloud settings (check/toggle cloud sync for account and app)
|
|
56
69
|
- **Steamworks Integration**: Direct FFI calls to Steamworks C++ SDK
|
|
57
70
|
- **Cross-Platform**: Windows, macOS, and Linux support
|
|
58
71
|
- **Batteries Included**: All Steamworks redistributables bundled - no SDK download needed!
|
|
@@ -148,13 +161,38 @@ if (initialized) {
|
|
|
148
161
|
const level = steam.friends.getFriendSteamLevel(friend.steamId);
|
|
149
162
|
console.log(`${name}: Level ${level}, Status: ${state}`);
|
|
150
163
|
|
|
164
|
+
// Get avatar handles
|
|
165
|
+
const smallAvatar = steam.friends.getSmallFriendAvatar(friend.steamId);
|
|
166
|
+
const mediumAvatar = steam.friends.getMediumFriendAvatar(friend.steamId);
|
|
167
|
+
if (smallAvatar > 0) {
|
|
168
|
+
console.log(` Avatar handles: small=${smallAvatar}, medium=${mediumAvatar}`);
|
|
169
|
+
}
|
|
170
|
+
|
|
151
171
|
// Check if playing a game
|
|
152
172
|
const gameInfo = steam.friends.getFriendGamePlayed(friend.steamId);
|
|
153
|
-
if (gameInfo
|
|
154
|
-
console.log(` Playing:
|
|
173
|
+
if (gameInfo) {
|
|
174
|
+
console.log(` Playing: App ${gameInfo.gameId}`);
|
|
155
175
|
}
|
|
156
176
|
});
|
|
157
177
|
|
|
178
|
+
// Check friend groups (tags)
|
|
179
|
+
const groupCount = steam.friends.getFriendsGroupCount();
|
|
180
|
+
if (groupCount > 0) {
|
|
181
|
+
const groupId = steam.friends.getFriendsGroupIDByIndex(0);
|
|
182
|
+
const groupName = steam.friends.getFriendsGroupName(groupId);
|
|
183
|
+
const members = steam.friends.getFriendsGroupMembersList(groupId);
|
|
184
|
+
console.log(`Group "${groupName}" has ${members.length} members`);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Check recently played with
|
|
188
|
+
const coplayCount = steam.friends.getCoplayFriendCount();
|
|
189
|
+
if (coplayCount > 0) {
|
|
190
|
+
const recentPlayer = steam.friends.getCoplayFriend(0);
|
|
191
|
+
const playerName = steam.friends.getFriendPersonaName(recentPlayer);
|
|
192
|
+
const coplayTime = steam.friends.getFriendCoplayTime(recentPlayer);
|
|
193
|
+
console.log(`Recently played with ${playerName}`);
|
|
194
|
+
}
|
|
195
|
+
|
|
158
196
|
// Set rich presence for custom status
|
|
159
197
|
steam.richPresence.setRichPresence('status', 'In Main Menu');
|
|
160
198
|
steam.richPresence.setRichPresence('connect', '+connect server:27015');
|
|
@@ -162,6 +200,38 @@ if (initialized) {
|
|
|
162
200
|
// Open Steam overlay
|
|
163
201
|
steam.overlay.activateGameOverlay('Friends'); // Open friends list
|
|
164
202
|
steam.overlay.activateGameOverlayToWebPage('https://example.com/wiki'); // Open wiki
|
|
203
|
+
|
|
204
|
+
// Steam Cloud storage operations
|
|
205
|
+
const saveData = { level: 5, score: 1000, inventory: ['sword', 'shield'] };
|
|
206
|
+
const buffer = Buffer.from(JSON.stringify(saveData));
|
|
207
|
+
|
|
208
|
+
// Write save file to Steam Cloud
|
|
209
|
+
const written = steam.cloud.fileWrite('savegame.json', buffer);
|
|
210
|
+
if (written) {
|
|
211
|
+
console.log('✅ Save uploaded to Steam Cloud');
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// Check cloud quota
|
|
215
|
+
const quota = steam.cloud.getQuota();
|
|
216
|
+
console.log(`Cloud storage: ${quota.usedBytes}/${quota.totalBytes} bytes (${quota.percentUsed.toFixed(2)}%)`);
|
|
217
|
+
|
|
218
|
+
// Read save file from Steam Cloud
|
|
219
|
+
if (steam.cloud.fileExists('savegame.json')) {
|
|
220
|
+
const result = steam.cloud.fileRead('savegame.json');
|
|
221
|
+
if (result.success && result.data) {
|
|
222
|
+
const loadedSave = JSON.parse(result.data.toString());
|
|
223
|
+
console.log(`Loaded save: Level ${loadedSave.level}, Score ${loadedSave.score}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
// List all cloud files
|
|
228
|
+
const cloudFiles = steam.cloud.getAllFiles();
|
|
229
|
+
console.log(`Steam Cloud contains ${cloudFiles.length} files:`);
|
|
230
|
+
cloudFiles.forEach(file => {
|
|
231
|
+
const kb = (file.size / 1024).toFixed(2);
|
|
232
|
+
const status = file.persisted ? '☁️' : '⏳';
|
|
233
|
+
console.log(`${status} ${file.name} - ${kb} KB`);
|
|
234
|
+
});
|
|
165
235
|
}
|
|
166
236
|
|
|
167
237
|
// Cleanup
|
|
@@ -210,9 +280,10 @@ Complete documentation for all APIs is available in the [docs folder](https://gi
|
|
|
210
280
|
- **[Achievement Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/ACHIEVEMENT_MANAGER.md)** - Complete achievement system (20 functions)
|
|
211
281
|
- **[Stats Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STATS_MANAGER.md)** - User and global statistics (14 functions)
|
|
212
282
|
- **[Leaderboard Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/LEADERBOARD_MANAGER.md)** - Leaderboard operations (7 functions)
|
|
213
|
-
- **[Friends Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)** - Friends and social features (
|
|
283
|
+
- **[Friends Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)** - Friends and social features (22 functions)
|
|
214
284
|
- **[Rich Presence Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/RICH_PRESENCE_MANAGER.md)** - Custom status display and join functionality (6 functions)
|
|
215
285
|
- **[Overlay Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/OVERLAY_MANAGER.md)** - Steam overlay control (7 functions)
|
|
286
|
+
- **[Cloud Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/CLOUD_MANAGER.md)** - Steam Cloud storage operations (14 functions)
|
|
216
287
|
|
|
217
288
|
## 🎮 Steamworks Integration
|
|
218
289
|
|
|
@@ -316,6 +387,8 @@ This ensures native libraries work correctly in packaged Electron apps!
|
|
|
316
387
|
- ✅ **macOS**: Included (libsteam_api.dylib)
|
|
317
388
|
- ✅ **Linux**: Included (libsteam_api.so)
|
|
318
389
|
|
|
390
|
+
**Steamworks SDK Version**: v1.62 (Latest)
|
|
391
|
+
|
|
319
392
|
All redistributable binaries are included in the package - no manual SDK download required!
|
|
320
393
|
|
|
321
394
|
## 🔧 Troubleshooting
|
|
@@ -40,6 +40,8 @@ export declare class SteamAPICore {
|
|
|
40
40
|
private utilsInterface;
|
|
41
41
|
/** Pointer to the ISteamFriends interface */
|
|
42
42
|
private friendsInterface;
|
|
43
|
+
/** Pointer to the ISteamRemoteStorage interface */
|
|
44
|
+
private remoteStorageInterface;
|
|
43
45
|
/**
|
|
44
46
|
* Creates a new SteamAPICore instance
|
|
45
47
|
*
|
|
@@ -278,5 +280,26 @@ export declare class SteamAPICore {
|
|
|
278
280
|
* - This is a native pointer for use with FFI calls
|
|
279
281
|
*/
|
|
280
282
|
getFriendsInterface(): any;
|
|
283
|
+
/**
|
|
284
|
+
* Gets the ISteamRemoteStorage interface pointer
|
|
285
|
+
*
|
|
286
|
+
* The Remote Storage interface provides access to Steam Cloud file operations,
|
|
287
|
+
* allowing you to save and sync game data across devices.
|
|
288
|
+
*
|
|
289
|
+
* @returns Pointer to ISteamRemoteStorage interface, or null if not initialized
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const remoteStorage = apiCore.getRemoteStorageInterface();
|
|
294
|
+
* if (remoteStorage) {
|
|
295
|
+
* // Use interface for cloud storage operations
|
|
296
|
+
* }
|
|
297
|
+
* ```
|
|
298
|
+
*
|
|
299
|
+
* @remarks
|
|
300
|
+
* - Returns null if Steam API is not initialized
|
|
301
|
+
* - This is a native pointer for use with FFI calls
|
|
302
|
+
*/
|
|
303
|
+
getRemoteStorageInterface(): any;
|
|
281
304
|
}
|
|
282
305
|
//# sourceMappingURL=SteamAPICore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SteamAPICore.d.ts","sourceRoot":"","sources":["../../src/internal/SteamAPICore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,YAAY;IACvB,kDAAkD;IAClD,OAAO,CAAC,aAAa,CAAqB;IAE1C,8DAA8D;IAC9D,OAAO,CAAC,WAAW,CAAkB;IAErC,4CAA4C;IAC5C,OAAO,CAAC,KAAK,CAAa;IAE1B,+CAA+C;IAC/C,OAAO,CAAC,kBAAkB,CAAa;IAEvC,0CAA0C;IAC1C,OAAO,CAAC,aAAa,CAAa;IAElC,2CAA2C;IAC3C,OAAO,CAAC,cAAc,CAAa;IAEnC,6CAA6C;IAC7C,OAAO,CAAC,gBAAgB,CAAa;IAErC;;;;OAIG;gBACS,aAAa,EAAE,kBAAkB;IAI7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"SteamAPICore.d.ts","sourceRoot":"","sources":["../../src/internal/SteamAPICore.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,qBAAa,YAAY;IACvB,kDAAkD;IAClD,OAAO,CAAC,aAAa,CAAqB;IAE1C,8DAA8D;IAC9D,OAAO,CAAC,WAAW,CAAkB;IAErC,4CAA4C;IAC5C,OAAO,CAAC,KAAK,CAAa;IAE1B,+CAA+C;IAC/C,OAAO,CAAC,kBAAkB,CAAa;IAEvC,0CAA0C;IAC1C,OAAO,CAAC,aAAa,CAAa;IAElC,2CAA2C;IAC3C,OAAO,CAAC,cAAc,CAAa;IAEnC,6CAA6C;IAC7C,OAAO,CAAC,gBAAgB,CAAa;IAErC,mDAAmD;IACnD,OAAO,CAAC,sBAAsB,CAAa;IAE3C;;;;OAIG;gBACS,aAAa,EAAE,kBAAkB;IAI7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,IAAI,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO;IAqFxC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,QAAQ,IAAI,IAAI;IAYhB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,SAAS,IAAI,WAAW;IAmBxB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,YAAY,IAAI,IAAI;IAUpB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,cAAc,IAAI,OAAO;IAYzB;;;;;;;;;;;;;;OAcG;IACH,aAAa,IAAI,OAAO;IAIxB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,qBAAqB,IAAI,GAAG;IAI5B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB,IAAI,GAAG;IAIvB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB,IAAI,GAAG;IAIxB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBAAmB,IAAI,GAAG;IAI1B;;;;;;;;;;;;;;;;;;;OAmBG;IACH,yBAAyB,IAAI,GAAG;CAGjC"}
|
|
@@ -80,6 +80,8 @@ class SteamAPICore {
|
|
|
80
80
|
this.utilsInterface = null;
|
|
81
81
|
/** Pointer to the ISteamFriends interface */
|
|
82
82
|
this.friendsInterface = null;
|
|
83
|
+
/** Pointer to the ISteamRemoteStorage interface */
|
|
84
|
+
this.remoteStorageInterface = null;
|
|
83
85
|
this.libraryLoader = libraryLoader;
|
|
84
86
|
}
|
|
85
87
|
/**
|
|
@@ -158,6 +160,11 @@ class SteamAPICore {
|
|
|
158
160
|
if (!this.friendsInterface || this.friendsInterface === null) {
|
|
159
161
|
console.warn('[Steamworks] WARNING: Failed to get SteamFriends interface');
|
|
160
162
|
}
|
|
163
|
+
// Get Remote Storage interface
|
|
164
|
+
this.remoteStorageInterface = this.libraryLoader.SteamAPI_SteamRemoteStorage_v016();
|
|
165
|
+
if (!this.remoteStorageInterface || this.remoteStorageInterface === null) {
|
|
166
|
+
console.warn('[Steamworks] WARNING: Failed to get SteamRemoteStorage interface');
|
|
167
|
+
}
|
|
161
168
|
// Request current stats from Steam servers
|
|
162
169
|
console.log('[Steamworks] Requesting current stats from Steam...');
|
|
163
170
|
const statsRequested = this.libraryLoader.SteamAPI_ISteamUserStats_RequestCurrentStats(this.userStatsInterface, 0);
|
|
@@ -430,6 +437,29 @@ class SteamAPICore {
|
|
|
430
437
|
getFriendsInterface() {
|
|
431
438
|
return this.friendsInterface;
|
|
432
439
|
}
|
|
440
|
+
/**
|
|
441
|
+
* Gets the ISteamRemoteStorage interface pointer
|
|
442
|
+
*
|
|
443
|
+
* The Remote Storage interface provides access to Steam Cloud file operations,
|
|
444
|
+
* allowing you to save and sync game data across devices.
|
|
445
|
+
*
|
|
446
|
+
* @returns Pointer to ISteamRemoteStorage interface, or null if not initialized
|
|
447
|
+
*
|
|
448
|
+
* @example
|
|
449
|
+
* ```typescript
|
|
450
|
+
* const remoteStorage = apiCore.getRemoteStorageInterface();
|
|
451
|
+
* if (remoteStorage) {
|
|
452
|
+
* // Use interface for cloud storage operations
|
|
453
|
+
* }
|
|
454
|
+
* ```
|
|
455
|
+
*
|
|
456
|
+
* @remarks
|
|
457
|
+
* - Returns null if Steam API is not initialized
|
|
458
|
+
* - This is a native pointer for use with FFI calls
|
|
459
|
+
*/
|
|
460
|
+
getRemoteStorageInterface() {
|
|
461
|
+
return this.remoteStorageInterface;
|
|
462
|
+
}
|
|
433
463
|
}
|
|
434
464
|
exports.SteamAPICore = SteamAPICore;
|
|
435
465
|
//# sourceMappingURL=SteamAPICore.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SteamAPICore.js","sourceRoot":"","sources":["../../src/internal/SteamAPICore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAI7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"SteamAPICore.js","sourceRoot":"","sources":["../../src/internal/SteamAPICore.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAI7B;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAa,YAAY;IAyBvB;;;;OAIG;IACH,YAAY,aAAiC;QA1B7C,8DAA8D;QACtD,gBAAW,GAAY,KAAK,CAAC;QAErC,4CAA4C;QACpC,UAAK,GAAW,CAAC,CAAC;QAE1B,+CAA+C;QACvC,uBAAkB,GAAQ,IAAI,CAAC;QAEvC,0CAA0C;QAClC,kBAAa,GAAQ,IAAI,CAAC;QAElC,2CAA2C;QACnC,mBAAc,GAAQ,IAAI,CAAC;QAEnC,6CAA6C;QACrC,qBAAgB,GAAQ,IAAI,CAAC;QAErC,mDAAmD;QAC3C,2BAAsB,GAAQ,IAAI,CAAC;QAQzC,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;IACrC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;IACH,IAAI,CAAC,OAAyB;QAC5B,IAAI,CAAC;YACH,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;YAE3B,kCAAkC;YAClC,OAAO,CAAC,GAAG,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YAE/C,uDAAuD;YACvD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,iBAAiB,CAAC,CAAC;YAClE,EAAE,CAAC,aAAa,CAAC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ACvB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACrC,CAAC;CACF;AArbD,oCAqbC"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { SteamLibraryLoader } from './SteamLibraryLoader';
|
|
2
|
+
import { SteamAPICore } from './SteamAPICore';
|
|
3
|
+
import { CloudFileInfo, CloudQuota, CloudFileReadResult } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Manager for Steam Cloud / Remote Storage operations
|
|
6
|
+
*
|
|
7
|
+
* The SteamCloudManager provides comprehensive access to Steam's cloud storage system,
|
|
8
|
+
* allowing you to save and synchronize game data across multiple devices.
|
|
9
|
+
*
|
|
10
|
+
* Key Features:
|
|
11
|
+
* - File operations (read, write, delete, check existence)
|
|
12
|
+
* - Quota management (check available space)
|
|
13
|
+
* - File iteration and metadata retrieval
|
|
14
|
+
* - Automatic synchronization across devices
|
|
15
|
+
* - Platform-specific sync control
|
|
16
|
+
*
|
|
17
|
+
* File Constraints:
|
|
18
|
+
* - Max file size: 100MB per write, 200MB total
|
|
19
|
+
* - Filenames are case-insensitive (converted to lowercase)
|
|
20
|
+
* - Max filename length: 260 characters
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* All methods require the Steam API to be initialized and cloud to be enabled.
|
|
24
|
+
* Files are automatically synced when Steam is running and connected.
|
|
25
|
+
*
|
|
26
|
+
* @example Basic file operations
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const steam = SteamworksSDK.getInstance();
|
|
29
|
+
* steam.init({ appId: 480 });
|
|
30
|
+
*
|
|
31
|
+
* // Write a save file
|
|
32
|
+
* const saveData = Buffer.from(JSON.stringify({ level: 5, score: 1000 }));
|
|
33
|
+
* const written = steam.cloud.fileWrite('savegame.json', saveData);
|
|
34
|
+
*
|
|
35
|
+
* // Read it back
|
|
36
|
+
* const result = steam.cloud.fileRead('savegame.json');
|
|
37
|
+
* if (result.success) {
|
|
38
|
+
* const data = JSON.parse(result.data.toString());
|
|
39
|
+
* console.log(`Level: ${data.level}, Score: ${data.score}`);
|
|
40
|
+
* }
|
|
41
|
+
*
|
|
42
|
+
* // Check quota
|
|
43
|
+
* const quota = steam.cloud.getQuota();
|
|
44
|
+
* console.log(`Using ${quota.percentUsed}% of cloud storage`);
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example List all cloud files
|
|
48
|
+
* ```typescript
|
|
49
|
+
* const files = steam.cloud.getAllFiles();
|
|
50
|
+
* files.forEach(file => {
|
|
51
|
+
* console.log(`${file.name}: ${file.size} bytes, modified ${new Date(file.timestamp * 1000)}`);
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* @see {@link https://partner.steamgames.com/doc/api/ISteamRemoteStorage ISteamRemoteStorage Documentation}
|
|
56
|
+
*/
|
|
57
|
+
export declare class SteamCloudManager {
|
|
58
|
+
/** Steam library loader for FFI function calls */
|
|
59
|
+
private libraryLoader;
|
|
60
|
+
/** Steam API core for initialization and callback management */
|
|
61
|
+
private apiCore;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new SteamCloudManager instance
|
|
64
|
+
*
|
|
65
|
+
* @param libraryLoader - The Steam library loader for FFI calls
|
|
66
|
+
* @param apiCore - The Steam API core for lifecycle management
|
|
67
|
+
*/
|
|
68
|
+
constructor(libraryLoader: SteamLibraryLoader, apiCore: SteamAPICore);
|
|
69
|
+
/**
|
|
70
|
+
* Writes a file to Steam Cloud
|
|
71
|
+
*
|
|
72
|
+
* @param filename - The name of the file to write (will be converted to lowercase)
|
|
73
|
+
* @param data - The data to write as a Buffer
|
|
74
|
+
* @returns True if the write was successful, false otherwise
|
|
75
|
+
*
|
|
76
|
+
* @remarks
|
|
77
|
+
* - Files are limited to 100MB per write and 200MB total
|
|
78
|
+
* - Filenames are automatically converted to lowercase
|
|
79
|
+
* - File is queued for upload when Steam is connected
|
|
80
|
+
* - Overwrites existing file with same name
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const saveData = Buffer.from(JSON.stringify({ level: 5 }));
|
|
85
|
+
* const success = steam.cloud.fileWrite('savegame.json', saveData);
|
|
86
|
+
* if (success) {
|
|
87
|
+
* console.log('Save file written to cloud');
|
|
88
|
+
* }
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
fileWrite(filename: string, data: Buffer): boolean;
|
|
92
|
+
/**
|
|
93
|
+
* Reads a file from Steam Cloud
|
|
94
|
+
*
|
|
95
|
+
* @param filename - The name of the file to read
|
|
96
|
+
* @returns CloudFileReadResult with success status and data
|
|
97
|
+
*
|
|
98
|
+
* @remarks
|
|
99
|
+
* - File must exist in cloud storage
|
|
100
|
+
* - Returns the complete file contents as a Buffer
|
|
101
|
+
* - Data can be converted to string or parsed as JSON
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const result = steam.cloud.fileRead('savegame.json');
|
|
106
|
+
* if (result.success && result.data) {
|
|
107
|
+
* const saveData = JSON.parse(result.data.toString());
|
|
108
|
+
* console.log('Loaded save:', saveData);
|
|
109
|
+
* }
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
fileRead(filename: string): CloudFileReadResult;
|
|
113
|
+
/**
|
|
114
|
+
* Checks if a file exists in Steam Cloud
|
|
115
|
+
*
|
|
116
|
+
* @param filename - The name of the file to check
|
|
117
|
+
* @returns True if the file exists, false otherwise
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* if (steam.cloud.fileExists('savegame.json')) {
|
|
122
|
+
* console.log('Save file found in cloud');
|
|
123
|
+
* }
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
fileExists(filename: string): boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Deletes a file from Steam Cloud
|
|
129
|
+
*
|
|
130
|
+
* @param filename - The name of the file to delete
|
|
131
|
+
* @returns True if the file was deleted, false otherwise
|
|
132
|
+
*
|
|
133
|
+
* @remarks
|
|
134
|
+
* - File is removed from cloud storage
|
|
135
|
+
* - Deletion is synchronized across all devices
|
|
136
|
+
* - Returns true even if file doesn't exist
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* const deleted = steam.cloud.fileDelete('old_save.json');
|
|
141
|
+
* if (deleted) {
|
|
142
|
+
* console.log('Save file deleted from cloud');
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
fileDelete(filename: string): boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Gets the size of a file in Steam Cloud
|
|
149
|
+
*
|
|
150
|
+
* @param filename - The name of the file
|
|
151
|
+
* @returns File size in bytes, or 0 if file doesn't exist
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const size = steam.cloud.getFileSize('savegame.json');
|
|
156
|
+
* console.log(`Save file is ${size} bytes`);
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
getFileSize(filename: string): number;
|
|
160
|
+
/**
|
|
161
|
+
* Gets the last modified timestamp of a file
|
|
162
|
+
*
|
|
163
|
+
* @param filename - The name of the file
|
|
164
|
+
* @returns Unix timestamp of last modification, or 0 if file doesn't exist
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const timestamp = steam.cloud.getFileTimestamp('savegame.json');
|
|
169
|
+
* const date = new Date(timestamp * 1000);
|
|
170
|
+
* console.log(`Last saved: ${date.toLocaleString()}`);
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
getFileTimestamp(filename: string): number;
|
|
174
|
+
/**
|
|
175
|
+
* Gets the total number of files in Steam Cloud for this app
|
|
176
|
+
*
|
|
177
|
+
* @returns Number of files in cloud storage
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```typescript
|
|
181
|
+
* const count = steam.cloud.getFileCount();
|
|
182
|
+
* console.log(`${count} files in cloud storage`);
|
|
183
|
+
* ```
|
|
184
|
+
*/
|
|
185
|
+
getFileCount(): number;
|
|
186
|
+
/**
|
|
187
|
+
* Gets the name and size of a file by index
|
|
188
|
+
*
|
|
189
|
+
* @param index - The index of the file (0 to GetFileCount()-1)
|
|
190
|
+
* @returns Object with name and size, or null if index is invalid
|
|
191
|
+
*
|
|
192
|
+
* @remarks
|
|
193
|
+
* Use this with getFileCount() to iterate through all files
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* const count = steam.cloud.getFileCount();
|
|
198
|
+
* for (let i = 0; i < count; i++) {
|
|
199
|
+
* const file = steam.cloud.getFileNameAndSize(i);
|
|
200
|
+
* if (file) {
|
|
201
|
+
* console.log(`${file.name}: ${file.size} bytes`);
|
|
202
|
+
* }
|
|
203
|
+
* }
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
getFileNameAndSize(index: number): {
|
|
207
|
+
name: string;
|
|
208
|
+
size: number;
|
|
209
|
+
} | null;
|
|
210
|
+
/**
|
|
211
|
+
* Gets detailed information about all files in Steam Cloud
|
|
212
|
+
*
|
|
213
|
+
* @returns Array of CloudFileInfo objects with complete metadata
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```typescript
|
|
217
|
+
* const files = steam.cloud.getAllFiles();
|
|
218
|
+
* files.forEach(file => {
|
|
219
|
+
* const date = new Date(file.timestamp * 1000);
|
|
220
|
+
* console.log(`${file.name}:`);
|
|
221
|
+
* console.log(` Size: ${file.size} bytes`);
|
|
222
|
+
* console.log(` Modified: ${date.toLocaleString()}`);
|
|
223
|
+
* console.log(` Persisted: ${file.persisted ? 'Yes' : 'No'}`);
|
|
224
|
+
* });
|
|
225
|
+
* ```
|
|
226
|
+
*/
|
|
227
|
+
getAllFiles(): CloudFileInfo[];
|
|
228
|
+
/**
|
|
229
|
+
* Checks if a file is persisted (uploaded) to Steam Cloud
|
|
230
|
+
*
|
|
231
|
+
* @param filename - The name of the file to check
|
|
232
|
+
* @returns True if the file is persisted to cloud, false otherwise
|
|
233
|
+
*
|
|
234
|
+
* @remarks
|
|
235
|
+
* Files may exist locally but not yet be uploaded to the cloud.
|
|
236
|
+
* This checks if the file has been successfully synced.
|
|
237
|
+
*
|
|
238
|
+
* @example
|
|
239
|
+
* ```typescript
|
|
240
|
+
* if (steam.cloud.filePersisted('savegame.json')) {
|
|
241
|
+
* console.log('Save file is synced to cloud');
|
|
242
|
+
* } else {
|
|
243
|
+
* console.log('Save file is still uploading...');
|
|
244
|
+
* }
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
filePersisted(filename: string): boolean;
|
|
248
|
+
/**
|
|
249
|
+
* Gets Steam Cloud quota information
|
|
250
|
+
*
|
|
251
|
+
* @returns CloudQuota object with total, available, and used bytes
|
|
252
|
+
*
|
|
253
|
+
* @remarks
|
|
254
|
+
* - Total quota varies by app (typically 100MB-1GB)
|
|
255
|
+
* - Available bytes = total - used
|
|
256
|
+
* - Quota is per-user, per-app
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* ```typescript
|
|
260
|
+
* const quota = steam.cloud.getQuota();
|
|
261
|
+
* console.log(`Cloud Storage: ${quota.usedBytes}/${quota.totalBytes} bytes`);
|
|
262
|
+
* console.log(`${quota.percentUsed.toFixed(1)}% used`);
|
|
263
|
+
* console.log(`${quota.availableBytes} bytes remaining`);
|
|
264
|
+
* ```
|
|
265
|
+
*/
|
|
266
|
+
getQuota(): CloudQuota;
|
|
267
|
+
/**
|
|
268
|
+
* Checks if Steam Cloud is enabled for the user's account
|
|
269
|
+
*
|
|
270
|
+
* @returns True if cloud is enabled at account level
|
|
271
|
+
*
|
|
272
|
+
* @remarks
|
|
273
|
+
* Users can disable Steam Cloud globally in their Steam settings.
|
|
274
|
+
* If disabled, file operations will fail.
|
|
275
|
+
*
|
|
276
|
+
* @example
|
|
277
|
+
* ```typescript
|
|
278
|
+
* if (!steam.cloud.isCloudEnabledForAccount()) {
|
|
279
|
+
* console.warn('User has disabled Steam Cloud in their settings');
|
|
280
|
+
* }
|
|
281
|
+
* ```
|
|
282
|
+
*/
|
|
283
|
+
isCloudEnabledForAccount(): boolean;
|
|
284
|
+
/**
|
|
285
|
+
* Checks if Steam Cloud is enabled for this specific app
|
|
286
|
+
*
|
|
287
|
+
* @returns True if cloud is enabled for this app
|
|
288
|
+
*
|
|
289
|
+
* @remarks
|
|
290
|
+
* Apps can enable/disable cloud storage independently.
|
|
291
|
+
* Even if account cloud is enabled, app cloud might be disabled.
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```typescript
|
|
295
|
+
* if (steam.cloud.isCloudEnabledForApp()) {
|
|
296
|
+
* console.log('Steam Cloud is active for this game');
|
|
297
|
+
* }
|
|
298
|
+
* ```
|
|
299
|
+
*/
|
|
300
|
+
isCloudEnabledForApp(): boolean;
|
|
301
|
+
/**
|
|
302
|
+
* Enables or disables Steam Cloud for this app
|
|
303
|
+
*
|
|
304
|
+
* @param enabled - True to enable cloud, false to disable
|
|
305
|
+
*
|
|
306
|
+
* @remarks
|
|
307
|
+
* - This is a per-app setting
|
|
308
|
+
* - User must have cloud enabled at account level
|
|
309
|
+
* - Changes are saved to Steam config
|
|
310
|
+
*
|
|
311
|
+
* @example
|
|
312
|
+
* ```typescript
|
|
313
|
+
* // Let user toggle cloud saves
|
|
314
|
+
* steam.cloud.setCloudEnabledForApp(userWantsCloudSaves);
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
setCloudEnabledForApp(enabled: boolean): void;
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=SteamCloudManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SteamCloudManager.d.ts","sourceRoot":"","sources":["../../src/internal/SteamCloudManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EA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