Commit Graph

56 Commits

Author SHA1 Message Date
catloversg
8553bcb8fc
MISC: Support compression of save data (#1162)
* Use Compression Streams API instead of jszip or other libraries.
* Remove usage of base64 in the new binary format.
* Do not convert binary data to string and back. The type of save data is SaveData, it's either string (old base64 format) or Uint8Array (new binary format).
* Proper support for interacting with electron-related code. Electron-related code assumes that save data is in the base64 format.
* Proper support for other tools (DevMenu, pretty-save.js). Full support for DevMenu will be added in a follow-up PR. Check the comments in src\DevMenu\ui\SaveFileDev.tsx for details.
2024-03-27 21:08:09 -07:00
Daniele Basso
9dd8275be1
Replace electron-config with electron-store. (#813) 2023-10-23 02:43:18 -04:00
omuretsu
93939431e9 Remove some unused electron code
Verified that steam exits the game even when a link has been opened, no need for utils.openExternal or tracking app_playerOpenedExternalLink.
Also removed some unneeded eslint override comments
2023-02-26 19:18:54 -05:00
Snarling
b9b5a62105
Fix electron link handling (#396) 2023-02-25 17:42:26 -05:00
Snarling
f266906f6f
ELECTRON: security fix (#319) 2023-01-10 19:12:23 -05:00
phyzical
85e65195e5 merg dev 2022-04-07 16:22:07 +08:00
Olivier Gagnon
48f80f25d6 fmt and lint 2022-04-06 19:30:08 -04:00
phyzical
6f09720393 added logic to add cmd/ctrl and +, cmd/ctrl and - cmd/ctrl and 0
* added logic to atleast allow arm64 to launch due to steam incopatibility
2022-04-02 23:04:48 +08:00
Martin Fournier
d386528627 Add support for Steam Cloud & local filesystem
Adds actions to save the game's data directly in the filesystem and/or
into Steam Cloud. Them game will push an event with the save data
whenever the game is saved. Electron will use that data to persist it
into the User Data folder, until the folder reaches a certain size.
Once over the quota, it's going to remove previous saves.

Files are grouped according the the player's identifier, ensuring
backups off different playthroughs if importing.

Optionally, the file will be gzipped before saving to disk, largely
reducing file size.

Adds a way to save & load from Steam Cloud, currently manually only.

When loading a save, it'll trigger the new "Import Data Comparison" page
to accept or cancel the import.

When saving the game, it will save to Steam Cloud & to filesystem if the
options are enabled.

Add automatic game restore

Detects when the player has access to a newer game that has been saved
more recently than the one being loaded. It checks both in the Steam
Cloud and on the local filesystem. Adds an option to disable the
feature.

- Adds a "Save Game" menu item that triggers the game's save.
- Adds a "Export Game" menu item that triggers the download file popup.
- Adds a "Export Scripts" menu item that triggers the "download *"
terminal command.
- Adds a "Load Last Save" menu item that loads the latest file modified
in the user data folder.
- Adds a "Load from Steam Cloud" menu item.
- Adds a "Load From File" menu item that popups a file selector & loads
the file.
- Adds settings for "Saves Compression (.gz)", "Auto-save Backups" &
"Auto-save to Steam", toggleable through the menu.
- Adds a "Open Game Data","Open Saves", "Open Logs" & "Open User Data" menu items.
- Adds a "Quit" menu item.
2022-01-26 03:56:19 -05:00
Martin Fournier
abfb2127f2 Fix 'Steam not running' popup causing crash on Mac 2022-01-23 13:04:19 -05:00
Martin Fournier
8192ab09ef Handle greenworks.init() errors gracefully
Since we are only using it to track achievements, we can still launch
the game if it fails to initialize, we just have to not run the
achievements interval.

Adds a dialog that tells the user to fix the issue & restart the game to
enable achievements.
2022-01-14 06:06:59 -05:00
hydroflame
a2d75ae10c
Merge branch 'dev' into feature/alert-close-browser 2022-01-02 11:44:47 -05:00
Martin Fournier
b402cc7f6e Add warning on game close if user launched browser 2021-12-31 04:22:04 -05:00
Martin Fournier
bc0791840f Add launch option to directly export save game
If --export-save is set, it will not launch the index.html and instead
launch a blank page. It then reads from the IndexedDb to fetch the
bitburnerSave value and prompts a save file dialog.
2021-12-30 11:51:15 -05:00
Martin Fournier
bf1a2b56ba Use global references for electron event handlers
I messed up the handlers reference in the last commit so the events
were not properly attached. Changed it to use global variables for now.
2021-12-30 09:12:55 -05:00
Martin Fournier
a098289856 Refactor electron app into multiple files
Gracefully handle http-server start error & cleanup logs
2021-12-29 08:46:56 -05:00
Martin Fournier
5d7d72a3e2 Add authorization token to file system api 2021-12-28 15:37:22 -05:00
Martin Fournier
ea03889082 Crash render process when javascript won't execute
Prevents the renderer process staying up when the user scripts are
waiting for an unresolved promise.
2021-12-23 07:48:01 -05:00
hydroflame
bfdfee2a68
Merge branch 'dev' into mychanges 2021-12-22 16:16:24 -05:00
Olivier Gagnon
d2d6c33fc8 mychanges 2021-12-22 16:15:56 -05:00
Martin Fournier
6363c704db Handle electron process uncaught exceptions
Handling the exceptions and closing the app seem to properly kill the
dangling processes that appear at launch in Windows 10. Without this, if
an exception is throw before the window is active (ie: no
steamapp_id.txt file), there will be remaining processes.

Added electron-log to additionally log to a text file.
2021-12-22 15:28:55 -05:00
Martin Fournier
9ce8bdd29b Add dialog when app is unresponsive to reload
Checks the electron event 'unresponsive' and triggers a reload / cancel
dialog. Allows all scripts to be killed, checked by default.
Also adds a warning to the terminal when noScript has been executed.
2021-12-22 15:14:03 -05:00
Olivier Gagnon
b2b682fa04 fix editor not loading files 2021-12-21 13:44:18 -05:00
Martin Fournier
3b99da8474 Lint current problems & fix ignore paths 2021-12-19 13:17:44 -05:00
Olivier Gagnon
21191e0b8d re-add noscripts 2021-12-18 10:44:22 -05:00
Olivier Gagnon
1368e468bb Merge branch 'dev' of github.com:danielyxie/bitburner into dev 2021-12-18 10:31:59 -05:00
Olivier Gagnon
5bb304caff rm console log 2021-12-17 16:33:55 -05:00
hydroflame
b122cebc98
Merge pull request #1972 from MartinFournier/feature/electron-background-color
Fix #1902: Set default electron color to black
2021-12-17 12:55:32 -05:00
hydroflame
c6843b231a Merge pull request #1962 from MartinFournier/feature/exit-process
Attempt to fix processes that stay up after closing app
2021-12-17 12:13:50 -05:00
hydroflame
196086cc13
Merge branch 'dev' into feature/exit-process 2021-12-17 11:49:58 -05:00
Olivier Gagnon
36fd3c5d68 try kill again 2021-12-17 11:38:00 -05:00
Martin Fournier
6d94ee0c2c Fix #1902: Set default electron color to black
If loading of the index.html is slow, there should be no white
background anymore.
2021-12-17 05:52:31 -05:00
Olivier Gagnon
6c5842d2e7 noscripts backup 2021-12-17 01:33:35 -05:00
Olivier Gagnon
795df0ed69 only exit? 2021-12-16 23:13:05 -05:00
Martin Fournier
63f7775804 Remove process handler when doing a hard reload 2021-12-16 20:21:25 -05:00
Olivier Gagnon
99f3566e52 bugfix 2021-12-16 20:09:19 -05:00
Martin Fournier
dc21a5b87b Attempt to fix processes that stay up after closing app 2021-12-16 18:26:20 -05:00
Olivier Gagnon
1cca819f87 disable browser throttling 2021-12-16 15:48:40 -05:00
Olivier Gagnon
e3a0caf50f fix killall steam not working 2021-12-14 22:34:09 -05:00
Olivier Gagnon
de9fb24156 Fix scripts dying of weird causes. 2021-12-13 22:26:22 -05:00
Olivier Gagnon
cdeabfec0e Steam enable debug 2021-12-12 13:25:28 -05:00
Olivier Gagnon
eb77bf352c fullscreen for steam 2021-12-12 12:58:57 -05:00
Olivier Gagnon
c845fb4203 reload n kill on steam 2021-12-12 12:48:42 -05:00
Olivier Gagnon
773f50ba67 doc n steam copypaste 2021-12-02 18:42:30 -05:00
Olivier Gagnon
ffd1bd3ab0 build theit pr 2021-12-02 12:43:00 -05:00
Olivier Gagnon
7ee5d8d71a more achievements 2021-11-28 23:51:01 -05:00
Olivier Gagnon
e262c9bb38 achievements 2021-11-27 15:07:25 -05:00
Olivier Gagnon
5d37eecdd6 electron debug flag 2021-11-05 00:19:41 -04:00
Your Name
74739af031 ok 2021-11-05 00:14:11 -04:00
Olivier Gagnon
c5fb5155f3 work on making sure all the functions are accounted for 2021-11-03 18:16:10 -04:00