@thenick775/mgba-wasm 2.3.1 → 2.3.2

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/dist/mgba.d.ts CHANGED
@@ -9,6 +9,7 @@ declare namespace mGBA {
9
9
  saveStatePath: string;
10
10
  screenshotsPath: string;
11
11
  patchPath: string;
12
+ autosave: string;
12
13
  }
13
14
 
14
15
  // see: https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/state
@@ -56,7 +57,7 @@ declare namespace mGBA {
56
57
  getFastForwardMultiplier(): number;
57
58
  getMainLoopTimingMode(): number;
58
59
  getMainLoopTimingValue(): number;
59
- getSave(): Uint8Array;
60
+ getSave(): Uint8Array | null;
60
61
  getVolume(): number;
61
62
  listRoms(): string[];
62
63
  listSaves(): string[];
@@ -64,7 +65,7 @@ declare namespace mGBA {
64
65
  loadState(slot: number): boolean;
65
66
  forceAutoSaveState(): boolean;
66
67
  loadAutoSaveState(): boolean;
67
- getAutoSaveState(): { autoSaveStateName: string; data: Uint8Array };
68
+ getAutoSaveState(): { autoSaveStateName: string; data: Uint8Array } | null;
68
69
  uploadAutoSaveState(
69
70
  autoSaveStateName: string,
70
71
  data: Uint8Array
package/dist/mgba.js CHANGED
@@ -81,7 +81,9 @@ Module.loadGame = (romPath, savePathOverride) => {
81
81
  };
82
82
 
83
83
  Module.getSave = () => {
84
- return FS.readFile(Module.saveName);
84
+ const exists = FS.analyzePath(Module.saveName).exists;
85
+
86
+ return exists ? FS.readFile(Module.saveName) : null;
85
87
  };
86
88
 
87
89
  Module.listRoms = () => {
@@ -155,6 +157,7 @@ Module.filePaths = () => {
155
157
  saveStatePath: '/data/states',
156
158
  screenshotsPath: '/data/screenshots',
157
159
  patchPath: '/data/patches',
160
+ autosave: '/autosave',
158
161
  };
159
162
  };
160
163
 
@@ -392,10 +395,14 @@ Module.loadAutoSaveState = () => {
392
395
  };
393
396
 
394
397
  Module.getAutoSaveState = () => {
395
- return {
396
- autoSaveStateName: Module.autoSaveStateName,
397
- data: FS.readFile(Module.autoSaveStateName),
398
- };
398
+ const exists = FS.analyzePath(Module.autoSaveStateName).exists;
399
+
400
+ return exists
401
+ ? {
402
+ autoSaveStateName: Module.autoSaveStateName,
403
+ data: FS.readFile(Module.autoSaveStateName),
404
+ }
405
+ : null;
399
406
  };
400
407
 
401
408
  Module.uploadAutoSaveState = async (autoSaveStateName, data) => {
package/dist/mgba.wasm CHANGED
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thenick775/mgba-wasm",
3
- "version": "2.3.1",
3
+ "version": "2.3.2",
4
4
  "description": "mGBA emulator compiled to webassembly",
5
5
  "main": "./dist/mgba.js",
6
6
  "types": "./dist/mgba.d.ts",