steamworks-ffi-node 0.5.2 → 0.6.0
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 +65 -55
- 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/SteamLibraryLoader.d.ts +15 -0
- package/dist/internal/SteamLibraryLoader.d.ts.map +1 -1
- package/dist/internal/SteamLibraryLoader.js +81 -30
- 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/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/docs/README.md +155 -0
- package/docs/STEAMWORKS_SDK_SETUP.md +209 -0
- package/package.json +9 -3
- package/postinstall.js +34 -0
- package/verify-sdk-setup.js +220 -0
- package/THIRD_PARTY_LICENSES.md +0 -24
- package/steamworks_sdk/redistributable_bin/linux32/libsteam_api.so +0 -0
- package/steamworks_sdk/redistributable_bin/linux64/libsteam_api.so +0 -0
- package/steamworks_sdk/redistributable_bin/osx/libsteam_api.dylib +0 -0
- package/steamworks_sdk/redistributable_bin/steam_api.dll +0 -0
- package/steamworks_sdk/redistributable_bin/steam_api.lib +0 -0
- package/steamworks_sdk/redistributable_bin/win64/steam_api64.dll +0 -0
- package/steamworks_sdk/redistributable_bin/win64/steam_api64.lib +0 -0
package/README.md
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
# Steamworks FFI - Steamworks SDK Integration
|
|
5
5
|
|
|
6
|
-
A
|
|
6
|
+
A 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
|
|
|
@@ -21,6 +21,8 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
|
|
|
21
21
|
|
|
22
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)
|
|
23
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
|
+
|
|
24
26
|
## 🎯 Features
|
|
25
27
|
|
|
26
28
|
- **Complete Achievement API**: 100% coverage of Steam Achievement functionality (20/20 functions)
|
|
@@ -58,9 +60,15 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
|
|
|
58
60
|
- ✅ Open overlay web browser to URLs
|
|
59
61
|
- ✅ Open store pages with purchase options
|
|
60
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)
|
|
61
69
|
- **Steamworks Integration**: Direct FFI calls to Steamworks C++ SDK
|
|
62
70
|
- **Cross-Platform**: Windows, macOS, and Linux support
|
|
63
|
-
- **
|
|
71
|
+
- **Easy Setup**: Simple installation with clear SDK setup guide
|
|
64
72
|
- **Electron Ready**: Perfect for Electron applications
|
|
65
73
|
- **TypeScript Support**: Complete TypeScript definitions included
|
|
66
74
|
- **No C++ Compilation**: Uses Koffi FFI for seamless installation
|
|
@@ -70,18 +78,25 @@ A production-ready TypeScript/JavaScript wrapper for the Steamworks SDK using Ko
|
|
|
70
78
|
### Installation
|
|
71
79
|
|
|
72
80
|
```bash
|
|
73
|
-
# Install the package
|
|
81
|
+
# Install the package
|
|
74
82
|
npm install steamworks-ffi-node
|
|
75
83
|
```
|
|
76
84
|
|
|
77
85
|
### Setup
|
|
78
86
|
|
|
79
|
-
1. **
|
|
87
|
+
1. **Download Steamworks SDK** (required separately due to licensing):
|
|
88
|
+
- Visit [Steamworks Partner site](https://partner.steamgames.com/)
|
|
89
|
+
- Download the latest Steamworks SDK
|
|
90
|
+
- Extract and copy `redistributable_bin` folder to your project
|
|
91
|
+
- See [STEAMWORKS_SDK_SETUP.md](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/STEAMWORKS_SDK_SETUP.md) for detailed instructions
|
|
92
|
+
|
|
93
|
+
2. **Create `steam_appid.txt` (optional)** in your project root:
|
|
80
94
|
```bash
|
|
81
95
|
echo "480" > steam_appid.txt # Use 480 for testing, or your Steam App ID
|
|
82
96
|
```
|
|
97
|
+
*Note: You can skip this file and pass the App ID directly to `steam.init(appId)` instead*
|
|
83
98
|
|
|
84
|
-
|
|
99
|
+
3. **Make sure Steam is running** and you're logged in
|
|
85
100
|
|
|
86
101
|
### Basic Usage
|
|
87
102
|
|
|
@@ -192,6 +207,38 @@ if (initialized) {
|
|
|
192
207
|
// Open Steam overlay
|
|
193
208
|
steam.overlay.activateGameOverlay('Friends'); // Open friends list
|
|
194
209
|
steam.overlay.activateGameOverlayToWebPage('https://example.com/wiki'); // Open wiki
|
|
210
|
+
|
|
211
|
+
// Steam Cloud storage operations
|
|
212
|
+
const saveData = { level: 5, score: 1000, inventory: ['sword', 'shield'] };
|
|
213
|
+
const buffer = Buffer.from(JSON.stringify(saveData));
|
|
214
|
+
|
|
215
|
+
// Write save file to Steam Cloud
|
|
216
|
+
const written = steam.cloud.fileWrite('savegame.json', buffer);
|
|
217
|
+
if (written) {
|
|
218
|
+
console.log('✅ Save uploaded to Steam Cloud');
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
// Check cloud quota
|
|
222
|
+
const quota = steam.cloud.getQuota();
|
|
223
|
+
console.log(`Cloud storage: ${quota.usedBytes}/${quota.totalBytes} bytes (${quota.percentUsed.toFixed(2)}%)`);
|
|
224
|
+
|
|
225
|
+
// Read save file from Steam Cloud
|
|
226
|
+
if (steam.cloud.fileExists('savegame.json')) {
|
|
227
|
+
const result = steam.cloud.fileRead('savegame.json');
|
|
228
|
+
if (result.success && result.data) {
|
|
229
|
+
const loadedSave = JSON.parse(result.data.toString());
|
|
230
|
+
console.log(`Loaded save: Level ${loadedSave.level}, Score ${loadedSave.score}`);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
// List all cloud files
|
|
235
|
+
const cloudFiles = steam.cloud.getAllFiles();
|
|
236
|
+
console.log(`Steam Cloud contains ${cloudFiles.length} files:`);
|
|
237
|
+
cloudFiles.forEach(file => {
|
|
238
|
+
const kb = (file.size / 1024).toFixed(2);
|
|
239
|
+
const status = file.persisted ? '☁️' : '⏳';
|
|
240
|
+
console.log(`${status} ${file.name} - ${kb} KB`);
|
|
241
|
+
});
|
|
195
242
|
}
|
|
196
243
|
|
|
197
244
|
// Cleanup
|
|
@@ -243,6 +290,7 @@ Complete documentation for all APIs is available in the [docs folder](https://gi
|
|
|
243
290
|
- **[Friends Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/FRIENDS_MANAGER.md)** - Friends and social features (22 functions)
|
|
244
291
|
- **[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)
|
|
245
292
|
- **[Overlay Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/OVERLAY_MANAGER.md)** - Steam overlay control (7 functions)
|
|
293
|
+
- **[Cloud Manager](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/docs/CLOUD_MANAGER.md)** - Steam Cloud storage operations (14 functions)
|
|
246
294
|
|
|
247
295
|
## 🎮 Steamworks Integration
|
|
248
296
|
|
|
@@ -295,66 +343,33 @@ app.on('before-quit', () => {
|
|
|
295
343
|
});
|
|
296
344
|
```
|
|
297
345
|
|
|
298
|
-
### 📦 Packaging
|
|
346
|
+
### 📦 Electron Packaging
|
|
299
347
|
|
|
300
|
-
|
|
348
|
+
For Electron applications, the library will automatically detect the Steamworks SDK files in your project directory. No special packaging configuration is needed - just ensure your `steamworks_sdk/redistributable_bin` folder is present in your project.
|
|
301
349
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
Add to your `package.json` or `electron-builder.yml`:
|
|
305
|
-
|
|
306
|
-
```json
|
|
307
|
-
{
|
|
308
|
-
"build": {
|
|
309
|
-
"asarUnpack": [
|
|
310
|
-
"node_modules/steamworks-ffi-node/**/*"
|
|
311
|
-
]
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
#### electron-forge Configuration
|
|
317
|
-
|
|
318
|
-
Add to your `forge.config.js`:
|
|
319
|
-
|
|
320
|
-
```javascript
|
|
321
|
-
module.exports = {
|
|
322
|
-
packagerConfig: {
|
|
323
|
-
asar: {
|
|
324
|
-
unpack: "**/{node_modules/steamworks-ffi-node}/**/*"
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
};
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
The library will automatically:
|
|
331
|
-
1. Detect if running inside an ASAR archive
|
|
332
|
-
2. Replace `.asar` with `.asar.unpacked` in the library path
|
|
333
|
-
3. Load the Steamworks SDK from the unpacked directory
|
|
334
|
-
|
|
335
|
-
This ensures native libraries work correctly in packaged Electron apps!
|
|
350
|
+
The library searches for the SDK in standard locations within your Electron app bundle.
|
|
336
351
|
|
|
337
352
|
## 🔧 Requirements
|
|
338
353
|
|
|
339
354
|
- **Node.js**: 18+
|
|
340
355
|
- **Steam Client**: Must be running and logged in
|
|
341
356
|
- **Steam App ID**: Get yours at [Steamworks Partner](https://partner.steamgames.com/)
|
|
342
|
-
- **steam_appid.txt**:
|
|
357
|
+
- **steam_appid.txt**: Optional - create in your project root OR pass to `steam.init(appId)`
|
|
343
358
|
|
|
344
359
|
### Platform Support
|
|
345
|
-
- ✅ **Windows**:
|
|
346
|
-
- ✅ **macOS**:
|
|
347
|
-
- ✅ **Linux**:
|
|
360
|
+
- ✅ **Windows**: steam_api64.dll / steam_api.dll
|
|
361
|
+
- ✅ **macOS**: libsteam_api.dylib
|
|
362
|
+
- ✅ **Linux**: libsteam_api.so
|
|
348
363
|
|
|
349
364
|
**Steamworks SDK Version**: v1.62 (Latest)
|
|
350
365
|
|
|
351
|
-
|
|
366
|
+
*Note: You must download and install the SDK redistributables separately as described in the Setup section above.*
|
|
352
367
|
|
|
353
368
|
## 🔧 Troubleshooting
|
|
354
369
|
|
|
355
370
|
### "SteamAPI_Init failed"
|
|
356
371
|
- ❌ Steam client not running → **Solution**: Start Steam and log in
|
|
357
|
-
- ❌
|
|
372
|
+
- ❌ No App ID specified → **Solution**: Create `steam_appid.txt` in project root OR pass App ID to `steam.init(appId)`
|
|
358
373
|
- ❌ Invalid App ID → **Solution**: Use 480 for testing, or your registered App ID
|
|
359
374
|
|
|
360
375
|
### "Cannot find module 'steamworks-ffi-node'"
|
|
@@ -368,16 +383,11 @@ All redistributable binaries are included in the package - no manual SDK downloa
|
|
|
368
383
|
### Electron-specific issues
|
|
369
384
|
- ❌ Initialized in renderer → **Solution**: Only initialize in main process
|
|
370
385
|
- ❌ Not cleaning up → **Solution**: Call `shutdown()` in `before-quit` event
|
|
371
|
-
- ❌ "
|
|
372
|
-
- ❌ Native module errors in packaged app → **Solution**: Ensure
|
|
386
|
+
- ❌ "Steamworks SDK library not found" in packaged app → **Solution**: Include SDK redistributables in your build (see Electron Packaging section above)
|
|
387
|
+
- ❌ Native module errors in packaged app → **Solution**: Ensure Steamworks SDK files are properly included in your app bundle
|
|
373
388
|
|
|
374
389
|
## 📄 License
|
|
375
390
|
|
|
376
391
|
MIT License - see LICENSE file for details.
|
|
377
392
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
This package includes redistributable binaries from the Steamworks SDK (© Valve Corporation).
|
|
381
|
-
These are distributed under the Steamworks SDK Access Agreement in accordance with Section 1.1(b).
|
|
382
|
-
|
|
383
|
-
See [THIRD_PARTY_LICENSES.md](https://github.com/ArtyProf/steamworks-ffi-node/blob/main/THIRD_PARTY_LICENSES.md) for full details.
|
|
393
|
+
**Note**: This package requires the Steamworks SDK redistributables to be installed separately by users. Users are responsible for complying with Valve's Steamworks SDK Access Agreement when downloading and using the SDK.
|
|
@@ -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.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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;Q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AcG;IACH,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,qBAAqB;QACnB,OAAO,IAAI,CAAC,kBAAkB,CAAC;IACjC,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,cAAc,CAAC;IAC7B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,mBAAmB;QACjB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACH,yBAAyB;QACvB,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,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EACL,aAAa,EACb,UAAU,EAEV,mBAAmB,EAGpB,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,qBAAa,iBAAiB;IAC5B,kDAAkD;IAClD,OAAO,CAAC,aAAa,CAAqB;IAE1C,gEAAgE;IAChE,OAAO,CAAC,OAAO,CAAe;IAE9B;;;;;OAKG;gBACS,aAAa,EAAE,kBAAkB,EAAE,OAAO,EAAE,YAAY;IAKpE;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO;IA2BlD;;;;;;;;;;;;;;;;;;;OAmBG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB;IAiD/C;;;;;;;;;;;;OAYG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAkBrC;;;;;;;;;;;;;;;;;;OAkBG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAkBrC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