mirror of
https://github.com/felixrieseberg/windows95.git
synced 2026-05-09 08:28:24 +00:00
* Detect orphaned state-vN.bin and offer file recovery to a host folder When STATE_VERSION is bumped, users previously lost their C:\ silently. The Welcome card now detects an older state file (v4+), explains what happened, and offers a one-click recovery: spin up a throwaway v86 (no boot), restore the legacy state to populate the hda dirty-block overlay, walk the FAT32 tree reading overlay-if-dirty-else-base, and copy any file the guest ever wrote out to ~/Downloads/Recovered C Drive. Directories are created lazily so empty branches never appear; success and failure render in the panel (no native dialogs). The geometry constraint that keeps overlay+new-base valid is documented next to STATE_VERSION. Also makes the dev-mode CDP port overridable via WIN95_DEBUG_PORT so worktree instances don't fight over 9222. * prettier
51 lines
1.8 KiB
TypeScript
51 lines
1.8 KiB
TypeScript
import * as path from "path";
|
|
|
|
const IMAGES_PATH = path.join(__dirname, "../../images");
|
|
|
|
// Bump when a release ships a v86/hardware/disk-image change that can't load
|
|
// older state-vN.bin snapshots. The app will detect an orphaned older state
|
|
// and offer to export the user's old C:\ as a mountable .img.
|
|
//
|
|
// That export splices the state's dirty-block overlay onto the *current*
|
|
// windows95.img — which only works while the partition table and FAT geometry
|
|
// stay constant across releases. If you ever resize the disk or reformat with
|
|
// different cluster params, the recovered .img won't mount.
|
|
export const STATE_VERSION = 4;
|
|
|
|
export const CONSTANTS = {
|
|
IMAGES_PATH,
|
|
IMAGE_PATH: path.join(IMAGES_PATH, "windows95.img"),
|
|
IMAGE_DEFAULT_SIZE: 1073741824, // 1GB
|
|
DEFAULT_STATE_PATH: path.join(IMAGES_PATH, "default-state.bin"),
|
|
TOOLS_PATH: path.join(__dirname, "../../guest-tools"),
|
|
};
|
|
|
|
export const IPC_COMMANDS = {
|
|
TOGGLE_INFO: "TOGGLE_INFO",
|
|
SHOW_DISK_IMAGE: "SHOW_DISK_IMAGE",
|
|
ZOOM_IN: "ZOOM_IN",
|
|
ZOOM_OUT: "ZOOM_OUT",
|
|
ZOOM_RESET: "ZOOM_RESET",
|
|
// Machine instructions
|
|
MACHINE_START: "MACHINE_START",
|
|
MACHINE_BOOT_FROM_SCRATCH: "MACHINE_BOOT_FROM_SCRATCH",
|
|
MACHINE_RESTART: "MACHINE_RESTART",
|
|
MACHINE_STOP: "MACHINE_STOP",
|
|
MACHINE_RESET: "MACHINE_RESET",
|
|
MACHINE_ALT_F4: "MACHINE_ALT_F4",
|
|
MACHINE_ESC: "MACHINE_ESC",
|
|
MACHINE_ALT_ENTER: "MACHINE_ALT_ENTER",
|
|
MACHINE_CTRL_ALT_DEL: "MACHINE_CTRL_ALT_DEL",
|
|
// Machine events
|
|
MACHINE_STARTED: "MACHINE_STARTED",
|
|
MACHINE_STOPPED: "MACHINE_STOPPED",
|
|
// Else
|
|
APP_QUIT: "APP_QUIT",
|
|
GET_STATE_PATH: "GET_STATE_PATH",
|
|
GET_LEGACY_STATE_PATH: "GET_LEGACY_STATE_PATH",
|
|
GET_DOWNLOADS_PATH: "GET_DOWNLOADS_PATH",
|
|
GET_SMB_SHARE_PATH: "GET_SMB_SHARE_PATH",
|
|
SET_SMB_SHARE_PATH: "SET_SMB_SHARE_PATH",
|
|
PICK_FOLDER: "PICK_FOLDER",
|
|
};
|