mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-17 23:08:36 +02:00
MISC: Support importing Steam Cloud save file manually (#2583)
This commit is contained in:
@@ -6,7 +6,7 @@ const fs = require("fs/promises");
|
||||
const log = require("electron-log");
|
||||
const flatten = require("lodash/flatten");
|
||||
const Store = require("electron-store");
|
||||
const { isBinaryFormat } = require("./saveDataBinaryFormat");
|
||||
const { decodeBase64BytesToBytes, isBinaryFormat, isSteamCloudFormat } = require("./saveDataBinaryFormat");
|
||||
const store = new Store();
|
||||
const { steamworksClient } = require("./steamworksUtils");
|
||||
|
||||
@@ -224,7 +224,7 @@ async function getSteamCloudSaveData() {
|
||||
async function saveGameToDisk(window, electronGameData) {
|
||||
const currentFolder = getSaveFolder(window);
|
||||
let saveFolderSizeBytes = await getFolderSizeInBytes(currentFolder);
|
||||
const maxFolderSizeBytes = store.get("autosave-quota", 1e8); // 100Mb per playerIndentifier
|
||||
const maxFolderSizeBytes = store.get("autosave-quota", 1e8); // 100Mb
|
||||
const remainingSpaceBytes = maxFolderSizeBytes - saveFolderSizeBytes;
|
||||
log.debug(`Folder Usage: ${saveFolderSizeBytes} bytes`);
|
||||
log.debug(`Folder Capacity: ${maxFolderSizeBytes} bytes`);
|
||||
@@ -282,6 +282,9 @@ async function loadFileFromDisk(path) {
|
||||
if (isBinaryFormat(buffer)) {
|
||||
// Save file is in the binary format.
|
||||
content = buffer;
|
||||
} else if (isSteamCloudFormat(buffer)) {
|
||||
// Save file is in the Steam Cloud format.
|
||||
content = decodeBase64BytesToBytes(buffer);
|
||||
} else {
|
||||
// Save file is in the base64 format.
|
||||
content = buffer.toString("utf8");
|
||||
|
||||
Reference in New Issue
Block a user