Memory 64 support

This commit is contained in:
momo5502
2025-07-09 17:58:47 +02:00
parent adb94f37bd
commit b7dc284a9d
8 changed files with 66 additions and 10 deletions

View File

@@ -6,6 +6,7 @@ import { Settings } from "@/settings";
interface SettingsMenuProps {
settings: Settings;
allowWasm64: boolean;
onChange: (settings: Settings) => void;
}
@@ -105,6 +106,18 @@ export class SettingsMenu extends React.Component<SettingsMenuProps, Settings> {
/>
<Label htmlFor="settings-persist">Persist filesystem</Label>
</div>
<div className="flex gap-6">
<Checkbox
id="settings-mem64"
disabled={!this.props.allowWasm64}
checked={this.state.wasm64}
onCheckedChange={(checked: boolean) => {
this.setState({ wasm64: checked });
}}
/>
<Label htmlFor="settings-mem64">64-Bit WebAssembly</Label>
</div>
</div>
);
}

View File

@@ -1,4 +1,4 @@
import { createDefaultSettings, Settings, translateSettings } from "./settings";
import { Settings, translateSettings } from "./settings";
import * as flatbuffers from "flatbuffers";
import * as fbDebugger from "@/fb/debugger";
@@ -84,7 +84,7 @@ export class Emulator {
this.worker.onmessage = this._onMessage.bind(this);
}
async start(settings: Settings = createDefaultSettings(), file: string) {
async start(settings: Settings, file: string) {
this._setState(EmulationState.Running);
this.worker.postMessage({
message: "run",
@@ -92,6 +92,7 @@ export class Emulator {
file,
options: translateSettings(settings),
persist: settings.persist,
wasm64: settings.wasm64,
},
});
}

View File

@@ -5,6 +5,8 @@ import { Output } from "@/components/output";
import { Emulator, EmulationState, isFinalState } from "./emulator";
import { Filesystem, setupFilesystem } from "./filesystem";
import { memory64 } from "wasm-feature-detect";
import "./App.css";
import {
Popover,
@@ -45,6 +47,7 @@ interface PlaygroundState {
emulator: Emulator | null;
application: string | undefined;
drawerOpen: boolean;
allowWasm64: boolean;
}
function makePercentHandler(
@@ -93,7 +96,12 @@ export class Playground extends React.Component<
emulator: null,
drawerOpen: false,
application: undefined,
allowWasm64: false,
};
memory64().then((allowWasm64) => {
this.setState({ allowWasm64 });
});
}
async resetFilesys() {
@@ -272,6 +280,7 @@ export class Playground extends React.Component<
<PopoverContent>
<SettingsMenu
settings={this.state.settings}
allowWasm64={this.state.allowWasm64}
onChange={(s) => {
saveSettings(s);
this.setState({ settings: s });

View File

@@ -5,6 +5,7 @@ export interface Settings {
bufferStdout: boolean;
persist: boolean;
execAccess: boolean;
wasm64: boolean;
}
export function createDefaultSettings(): Settings {
@@ -15,6 +16,7 @@ export function createDefaultSettings(): Settings {
bufferStdout: true,
persist: false,
execAccess: true,
wasm64: false,
};
}