99 Commits

Author SHA1 Message Date
Felix Rieseberg
55e88cd5b5 fix: Update version number 2019-05-23 10:56:38 -07:00
Felix Rieseberg
e0ad866256 build: Fix Apple Code Signing 2019-05-23 10:18:57 -07:00
Felix Rieseberg
cf3acd4182 📝 Update readme links 2019-05-17 16:53:51 +09:00
Felix Rieseberg
a28aef8cf0 build: Oh, and don't install tree 2019-05-17 15:37:29 +09:00
Felix Rieseberg
d2b8d9dd35 build: Don't even tree 2019-05-17 15:31:48 +09:00
Felix Rieseberg
3802734ef0 build: Install tree on Linux 2019-05-17 15:31:13 +09:00
Felix Rieseberg
1f478676f1 build: Download images on Travis 2019-05-17 15:25:30 +09:00
Felix Rieseberg
d19bbeee8f build: Make standalone Windows builds 2019-05-17 15:25:21 +09:00
Felix Rieseberg
1e130b6140 build: Install x64 Node 2019-05-17 14:22:37 +09:00
Felix Rieseberg
e1c5992ff9 build: Add GitHub publisher 2019-05-17 13:56:02 +09:00
Felix Rieseberg
e879760678 build: Cut the flatpack 2019-05-17 13:43:39 +09:00
Felix Rieseberg
2a11633171 chore: Update version number to 2.1.0 2019-05-17 13:33:11 +09:00
Felix Rieseberg
b68d54ae62 build: Fix travis build 2019-05-17 13:32:28 +09:00
Felix Rieseberg
9600630340 build: Build on AppVeyor, too 2019-05-17 13:28:37 +09:00
Felix Rieseberg
bae1909793 build: What if we just don't asar? 2019-05-17 13:18:14 +09:00
Felix Rieseberg
ee9e138034 build: Enable verbose debugging 2019-05-17 13:01:56 +09:00
Felix Rieseberg
5558671688 build: Add a filename 2019-05-17 12:53:42 +09:00
Felix Rieseberg
9a46ed5080 build: Step by step, I guess 2019-05-17 12:43:54 +09:00
Felix Rieseberg
2c160d0f7f build: Add an AppVeyor file 2019-05-17 12:33:17 +09:00
Felix Rieseberg
aafab62707 chore: Update all dependencies 2019-05-17 12:30:03 +09:00
Felix Rieseberg
78126a57cb docs: Fix a typo 2019-02-22 11:41:46 +00:00
Felix Rieseberg
f5256ec7a2 docs: Add gitpod instructions 2019-02-22 11:40:56 +00:00
Felix Rieseberg
6c1687c9a5 Merge pull request #124 from jankeromnes/master
Add an online live demo
2019-02-22 11:39:07 +00:00
Jan Keromnes
2c041115d0 chore: Add online live demo 2019-02-13 15:31:23 +00:00
Felix Rieseberg
987dc57309 Merge pull request #117 from kant/patch-1
Formatting proposals
2019-02-12 00:05:42 -08:00
Darío Hereñú
614b18969d Formatting proposals 2019-02-08 13:58:24 -03:00
Felix Rieseberg
264ef7d069 Update README.md 2019-02-04 10:45:32 -08:00
Felix Rieseberg
e85cf4f1b2 docs: Add FrontPage credentials 2019-02-03 17:14:33 -08:00
Felix Rieseberg
e987da5460 docs: Update links 2019-02-03 17:13:39 -08:00
Felix Rieseberg
a542639bc3 docs: Update the readme with some answers 2019-02-03 16:49:19 -08:00
Felix Rieseberg
5d1928beb2 docs: Add instructions on how to mount the disk image 2019-02-03 16:45:58 -08:00
Felix Rieseberg
f1b657a53b docs: Remove link to CovalenceConf 2019-02-03 16:38:54 -08:00
Felix Rieseberg
6aa39e66ec 2.0.0 2019-02-03 15:40:31 -08:00
Felix Rieseberg
ed42ea8e0e fix: Ensure smooth migration 2019-02-03 15:38:06 -08:00
Felix Rieseberg
0779f18071 fix: Handle missing state 2019-02-03 15:24:29 -08:00
Felix Rieseberg
a9c4e38386 feat: Allow resetting the machien 2019-02-03 15:23:20 -08:00
Felix Rieseberg
62b0909cb4 fix: Correctly capture the mouse 2019-02-03 14:08:09 -08:00
Felix Rieseberg
873cb75241 fix: the various things I just broke 2019-02-03 14:02:30 -08:00
Felix Rieseberg
6467acb0c8 fix: Cleanup 2019-02-03 13:49:09 -08:00
Felix Rieseberg
ed1bd0a1e0 chore: Custom menu 2019-02-03 13:44:57 -08:00
Felix Rieseberg
ac84f4164e fix: Don't clear the cache on each start 2019-02-03 12:36:06 -08:00
Felix Rieseberg
77569d4ce6 infra: Update dependencies 2019-02-03 12:33:11 -08:00
Felix Rieseberg
68b7c181ad Merge pull request #109 from samuell/patch-1
Update README.md: Fix broken download links
2018-12-30 09:25:24 +01:00
Felix Rieseberg
293491477b Merge pull request #111 from malept/forge-arch-squirrel
chore: automatically add arch to squirrel installer filename
2018-12-30 09:24:56 +01:00
Felix Rieseberg
7eb750752b infra: Update to Electron 4.0 2018-12-30 09:22:32 +01:00
Mark Lee
f1488cedc2 Make it look more like a function 2018-12-26 22:41:56 -08:00
Mark Lee
9f366063eb chore: automatically add arch to squirrel installer filename 2018-12-26 22:40:08 -08:00
Samuel Lampa
55135f052e Update README.md: Fix download links
Fixes download links for Windows and the .deb Linux installer
2018-12-21 15:08:18 +01:00
Felix Rieseberg
95fd8e4925 chore: Update the readme with new download links 2018-12-20 11:25:33 -08:00
Felix Rieseberg
b794954da4 infra: Update dependencies 2018-12-20 10:32:00 -08:00
Felix Rieseberg
18a73c45a0 🚀 Mention CovalenceConf 2018-10-16 16:24:28 -07:00
Felix Rieseberg
b83914060f 📝 Update the Readme a little 2018-10-16 14:11:43 -07:00
Felix Rieseberg
93955564d9 Merge pull request #96 from jacobq/patch-1
Clarify support & purpose
2018-09-25 09:05:52 -07:00
Felix Rieseberg
d31920aaf4 📝 Spell out the actual platforms 2018-09-25 09:05:38 -07:00
Jacob
cdfe47d92b Clarify support & purpose
Close #90
2018-09-19 12:00:24 -05:00
Felix Rieseberg
b8259784e7 Merge pull request #89 from toolboc/dockerdocs
fix docker-instructions
2018-09-09 01:48:14 -07:00
Paul DeCarlo
b70b9fabd5 update docker-instructions.md 2018-09-08 12:20:51 -05:00
Felix Rieseberg
f2c1fc4142 Merge pull request #87 from argan/patch-1
also run on MacOS with XQuartz
2018-09-08 08:56:44 -07:00
Argan Wang
aeba364a7a also run on MacOS with XQuartz 2018-09-07 16:13:47 +08:00
Felix Rieseberg
a34ce54b56 📝 Fix name typo 2018-08-27 10:46:11 -07:00
Felix Rieseberg
e1477bfc05 📝 MS-DOS fixed 2018-08-27 10:29:15 -07:00
Felix Rieseberg
71d6f16318 📝 Make the downloads super-obvious 2018-08-27 08:53:27 -07:00
Felix Rieseberg
4bdbff6a4b 1.3.0 2018-08-27 08:29:52 -07:00
Felix Rieseberg
e062548c81 🔧 Add menu, credits 2018-08-27 08:26:34 -07:00
Felix Rieseberg
609668c581 📝 Add copy of v86 license 2018-08-27 08:13:42 -07:00
Felix Rieseberg
bec9577409 🔧 Update Readme 2018-08-27 08:12:38 -07:00
Felix Rieseberg
dd9ff5a319 Merge pull request #52 from toolboc/master
Add Dockerfile and instructions to run Win95 as a container
2018-08-27 08:11:19 -07:00
Felix Rieseberg
f5125219fd Merge pull request #66 from malept/add-flatpak-maker
🔧 add flatpak maker
2018-08-27 08:09:49 -07:00
Mark Lee
b4fd81b364 🔧 add flatpak maker 2018-08-26 11:06:40 -07:00
Paul DeCarlo
e62a8cbed6 Add detailed docker instructions to docs 2018-08-25 17:45:36 -05:00
Felix Rieseberg
2038ce9c31 📝 Update readme 2018-08-25 17:05:47 -05:00
toolboc
6c12063353 Add note on xhost for allowing connections to X11 2018-08-25 11:45:18 -05:00
toolboc
91783e7d26 Add libcanberra-gtk3-module 2018-08-25 11:25:13 -05:00
toolboc
9f8040bb22 Update Dockerfile 2018-08-25 10:35:09 -05:00
Felix Rieseberg
c261079b67 🔧 Read file on Windows 2018-08-25 01:06:09 -07:00
Felix Rieseberg
6f337ac986 🔧 Hide status 2018-08-24 23:21:12 -07:00
Felix Rieseberg
3189f3a8a2 🔧 Add some features 2018-08-24 23:01:33 -07:00
Felix Rieseberg
5c1af3ae86 🔧 Successfully show disk image when packaged 2018-08-24 21:33:51 -07:00
Felix Rieseberg
1ae2e5d546 📝 Update readme 2018-08-24 21:17:26 -07:00
Felix Rieseberg
7f3b23c5bf 📦 Update version number to 1.2 2018-08-24 21:16:56 -07:00
Felix Rieseberg
aa62c10700 🔧 Fancy things up a bit 2018-08-24 20:55:18 -07:00
Felix Rieseberg
86674b6090 🔧 Move to ES6 modules 2018-08-24 20:55:03 -07:00
Felix Rieseberg
90182076e6 📝 Update forge config 2018-08-24 20:03:32 -07:00
Paul DeCarlo
10d2e37e9d Add Dockerfile and instructions to run Win95 as a container 2018-08-24 17:00:31 -05:00
Felix Rieseberg
e03e6148db 📝 Make download text more obvious, I guess 2018-08-24 09:49:52 -07:00
Felix Rieseberg
59ee32806e 📝 Issue template 2018-08-23 23:11:48 -07:00
Felix Rieseberg
9b32bf58d9 📝 Fix typo 2018-08-23 21:55:42 -07:00
Felix Rieseberg
5bceb2e448 📝 Document Doom 2018-08-23 21:55:16 -07:00
Felix Rieseberg
6918c425d6 📝 Fix typo 2018-08-23 21:24:01 -07:00
Felix Rieseberg
8c3f608621 📝 Update readme 2018-08-23 16:23:08 -07:00
Felix Rieseberg
8b3117689e 🔧 Don't set scale on non-Windows 2018-08-23 16:16:40 -07:00
Felix Rieseberg
334a52b238 📝 Add issue template 2018-08-23 16:16:23 -07:00
Felix Rieseberg
c11ae3caea Merge pull request #16 from benwiley4000/click-listener
Clicking in the window re-captures the mouse.
2018-08-23 16:00:51 -07:00
Felix Rieseberg
1fbfca70b2 Merge branch 'master' into click-listener 2018-08-23 15:56:49 -07:00
Felix Rieseberg
9c1ba25119 Merge pull request #17 from shanselman/master
high-dpi support
2018-08-23 15:56:00 -07:00
Scott Hanselman
69d8b0d2be high-dpi support 2018-08-23 15:06:54 -07:00
Ben Wiley
4f34053a84 Clicking in the window re-captures the mouse. 2018-08-23 17:59:13 -04:00
Felix Rieseberg
5be27d7bab 📝 Another readme update 2018-08-23 07:50:32 -07:00
Felix Rieseberg
5ffbf4a106 📝 Update readme 2018-08-23 07:47:46 -07:00
34 changed files with 3037 additions and 1332 deletions

45
.appveyor.yml Normal file
View File

@@ -0,0 +1,45 @@
environment:
matrix:
- nodejs_version: "10"
init:
- git config --global core.symlinks true
install:
# Setup the code signing certificate
- ps: >-
if (Test-Path Env:\WINDOWS_CERTIFICATE_P12) {
$workingDirectory = Convert-Path (Resolve-Path -path ".")
$filename = "$workingDirectory\cert.p12"
$bytes = [Convert]::FromBase64String($env:WINDOWS_CERTIFICATE_P12)
[IO.File]::WriteAllBytes($filename, $bytes)
}
- ps: Install-Product node $env:nodejs_version x64
- node --version
- npm ci
- ps: cd ./src/
- ps: mkdir images
- ps: cd images
- ps: Start-FileDownload 'https://1drv.ws/u/s!AkfaAw_EaahOkulh8rA41x2phgfYXQ' -FileName images.zip -Timeout 600000
- ps: 7z x images.zip -y -aoa
- ps: Remove-Item images.zip
- ps: Remove-Item __MACOSX -Recurse -ErrorAction Ignore
- ps: cd ../..
- ps: Tree ./src /F
cache:
- '%APPDATA%\npm-cache -> appveyor.yml'
test_script:
- node --version
- npm --version
- npm run lint
artifacts:
- path: 'out\make\squirrel.windows\**\*.exe'
build_script:
- if %APPVEYOR_REPO_TAG% EQU false npm run make
- if %APPVEYOR_REPO_TAG% EQU true npm run publish
- if %APPVEYOR_REPO_TAG% EQU true npm run publish -- --arch=ia32
- ps: Tree ./out/make /F

2
.gitignore vendored
View File

@@ -1,4 +1,4 @@
node_modules
out
src/renderer/images
src/images
.DS_Store

64
.travis.yml Normal file
View File

@@ -0,0 +1,64 @@
language: node_js
node_js: "12"
os:
- linux
- osx
dist: trusty
osx_image: xcode8.3
sudo: false
cache:
directories:
- node_modules
- $HOME/.cache/electron
addons:
apt:
packages:
- fakeroot
- rpm
branches:
only:
- master
- /^v\d+\.\d+\.\d+/
install:
- npm install
- mkdir -p ./src/images
- cd ./src/images
- wget -O images.zip https://1drv.ws/u/s!AkfaAw_EaahOkulh8rA41x2phgfYXQ
- unzip -o images.zip
- rm images.zip
- rm -r __MACOSX
- cd ../..
- ls src
- ls src/images
- |
if [[ "$TRAVIS_OS_NAME" == "osx" && "$TRAVIS_SECURE_ENV_VARS" == "true" ]]; then
export CERTIFICATE_P12=cert.p12;
echo $MACOS_CERT_P12 | base64 --decode > $CERTIFICATE_P12;
export KEYCHAIN=build.keychain;
# Create the keychain with a password
security create-keychain -p travis $KEYCHAIN;
# Make the custom keychain default, so xcodebuild will use it for signing
security default-keychain -s $KEYCHAIN;
# Unlock the keychain
security unlock-keychain -p travis $KEYCHAIN;
# Add certificates to keychain and allow codesign to access them
# Apple Worldwide Developer Relations Certification Authority
security import ./assets/certs/apple.cer -k ~/Library/Keychains/$KEYCHAIN -T /usr/bin/codesign
# Developer Authentication Certification Authority
security import ./assets/certs/dac.cer -k ~/Library/Keychains/$KEYCHAIN -T /usr/bin/codesign
# Developer ID Felix
security import $CERTIFICATE_P12 -k $KEYCHAIN -P $MACOS_CERT_PASSWORD -T /usr/bin/codesign 2>&1 >/dev/null;
rm $CERTIFICATE_P12;
security set-key-partition-list -S apple-tool:,apple: -s -k travis $KEYCHAIN
# Echo the identity
security find-identity -v -p codesigning
fi
script:
- npm run lint
- if test -z "$TRAVIS_TAG"; then npm run make; fi
after_success: if test -n "$TRAVIS_TAG"; then npm run publish; fi

59
CREDITS.md Normal file
View File

@@ -0,0 +1,59 @@
# windows95 Credits
This app was made possible by three major engineering efforts:
* [v86 by Fabian Hemmer](https://github.com/copy/v86)
* [Electron by the Electron Maintainers](https://electronjs.org)
* Windows 95 by Microsoft
# v86 License and Copyright Notice
Copyright (c) 2012-2018, Fabian Hemmer
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
# Electron License and Copyright Notice
Copyright (c) 2013-2018 GitHub Inc.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

45
Dockerfile Normal file
View File

@@ -0,0 +1,45 @@
# DESCRIPTION: Run Windows 95 in a container
# AUTHOR: Paul DeCarlo <toolboc@gmail.com>
#
# Made possible through prior art by:
# copy (v86 - x86 virtualization in JavaScript)
# felixrieseberg (Windows95 running in electron)
# Microsoft (Windows 95)
#
# ***Docker Run Command***
#
# docker run -it \
# -v /tmp/.X11-unix:/tmp/.X11-unix \ # mount the X11 socket
# -e DISPLAY=unix$DISPLAY \ # pass the display
# --device /dev/snd \ # sound
# --name windows95 \
# toolboc/windows95
#
# ***TroubleShooting***
# If you receive Gtk-WARNING **: cannot open display: unix:0
# Run:
# xhost +
#
FROM node:10.9-stretch
LABEL maintainer "Paul DeCarlo <toolboc@gmail.com>"
RUN apt update && apt install -y \
libgtk-3-0 \
libcanberra-gtk3-module \
libx11-xcb-dev \
libgconf2-dev \
libnss3 \
libasound2 \
libxtst-dev \
libxss1 \
git \
--no-install-recommends && \
rm -rf /var/lib/apt/lists/*
COPY . .
RUN npm install
ENTRYPOINT [ "npm", "start"]

35
HELP.md Normal file
View File

@@ -0,0 +1,35 @@
# Help & Commonly Asked Questions
## MS-DOS seems to brick the screen
Hit `Alt + Enter` to make the command screen "full screen" (as far as Windows 95 is
concerned). This should restore the display from the garbled mess you see and allow
you to access the command prompt. Press Alt-Enter again to leave full screen and go
back to a window mode. (Thanks to @DisplacedGamer for that wisdom)
## Windows 95 is stuck in a bad state
Restart the application and click on the "Reset machine & delete state" button.
You can find it in the lower left of the screen. Then, hit the "Start Windows 95"
button to start your virtual machine again.
## I want to install additional apps or games
If you are running macOS, or Linux, you can probably "mount" the
virtual hard drive used by `windows95` to add files. Hit the "Show Disk Image"
button in the lower right of the app, which will take you to the disk image.
On macOS, double-click the disk image to open it.
On Windows 10, Windows will _think_ that it can open up the image, but will
actually fail to do so. Use a tool [like OSFMount][osfmount] to mount your
disk image.
On Linux, search the Internet for instructions on how to mount an `img` disk
image on your distribution. It's likely that you'll be able to run `mount`
with the image as input.
[osfmount]: https://www.osforensics.com/tools/mount-disk-images.html
## What's the FrontPage Username and Password?
Username: windows95
Password: password

View File

@@ -4,4 +4,35 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
____
v86 Source Code
Copyright (c) 2012-2018, Fabian Hemmer
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.

View File

@@ -1,11 +1,52 @@
# Windows95
# windows95
This is Windows 95, running in an Electron app. Yes, it's the full thing. I'm sorry.
This is Windows 95, running in an [Electron](https://electronjs.org/) app. Yes, it's the full thing. I'm sorry.
## Downloads
| | Windows | macOS | Linux |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Standalone Download | 📦[Standalone, 32-bit](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-2.1.0-win32-standalone-ia32.zip) <br /> 📦[Standalone, 64-bit](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-2.1.0-win32-standalone-x64.zip) | 📦[Standalone](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-macos-2.1.0.zip) | |
| Installer | 💽[Setup, 64-bit](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-2.1.0-setup-win32-x64.exe) <br /> 💽[Setup, 32-bit](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-2.1.0-setup-win32-ia32.exe) | | 💽[deb, 64-bit](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-linux-2.1.0_amd64.deb) <br /> 💽[rpm, 64-bit](https://github.com/felixrieseberg/windows95/releases/download/v2.1.0/windows95-linux-2.1.0.x86_64.rpm) |
![Screenshot](https://user-images.githubusercontent.com/1426799/44532591-4ceb3680-a6a8-11e8-8c2c-bc29f3bfdef7.png)
## Does it work?
Yes! Quite well, actually - on macOS, Windows, and Linux. Bear in mind that this is written entirely in JavaScript, so please adjust your expectations.
## Should this have been a native app?
Absolutely.
## Does it run Doom (or my other favorite game)?
You'll likely be better off with an actual virtualization app, but the short answer is yes. [Thanks to
@DisplacedGamers](https://youtu.be/xDXqmdFxofM) I can recommend that you switch to a resolution of
640x480 @ 256 colors before starting DOS games - just like in the good ol' days.
## Credits
99.999% of the work was done over at [v86](https://github.com/copy/v86/) by Copy.
## Contributing
Before you can run this from source, you'll need the disk image. It's not part of the
repository, but you can grab it using the `Show Disk Image` button from the packaged
release, which does include the disk image.
Unpack the `images` folder into the `src` folder, creating this layout:
```
./src/images/windows95.img
```
Once you've done so, run `npm install` and `npm start` to run your local build.
## Other Questions
* [MS-DOS seems to brick the screen](./HELP.md#ms-dos-seems-to-brick-the-screen)
* [Windows 95 is stuck in a bad state](./HELP.md#windows-95-is-stuck-in-a-bad-state)
* [I want to install additional apps or games](./HELP.md#i-want-to-install-additional-apps-or-games)
* [Running in Docker](./docs/docker-instructions.md)
* [Running in an online VM with Kubernetes and Gitpod](./docs/docker-kubernetes-gitpod.md)
## License
This project is provided for educational purposes only. It is not affiliated with and has

BIN
assets/certs/apple.cer Normal file

Binary file not shown.

BIN
assets/certs/dac.cer Normal file

Binary file not shown.

View File

@@ -0,0 +1,39 @@
# Running windows95 in Docker
## Display using a volume mount of the host X11 Unix Socket (Linux Only):
**Requirements:**
* Linux OS with a running X-Server Display
* [Docker](http://docker.io)
docker run -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY --device /dev/snd --name windows95 toolboc/windows95
Note: You may need to run `xhost +` on your system to allow connections to the X server running on the host.
## Display using Xming X11 Server over tcp Socket (Windows and beyond):
**Requirements:**
* [Xming](https://sourceforge.net/projects/xming/)
* [Docker](http://docker.io)
1. Start the Xming X11 Server
2. Run the command below:
docker run -e DISPLAY=host.docker.internal:0 --name windows95 toolboc/windows95
## Display using the host XQuartz Server (MacOS Only):
**Requirements:**
* [XQuartz](https://www.xquartz.org/)
* [Docker](http://docker.io)
1. Start XQuartz, go to `Preferences` -> `Security`, and check the box `Allow connections from network clients`
2. Restart XQuartz
3. In the terminal, run
```
xhost +
```
4. run
```
docker run -it -e DISPLAY=host.docker.internal:1 toolboc/windows95
```

View File

@@ -0,0 +1,4 @@
## Running an online version of windows95
You can also run windows95 in Electron, in a virtual X server, in a JavaScript VNC client, in a Kubernetes workspace. What could go wrong?
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/felixrieseberg/windows95)

View File

@@ -3,7 +3,7 @@ const package = require('./package.json');
module.exports = {
packagerConfig: {
asar: true,
asar: false,
icon: path.resolve(__dirname, 'assets', 'icon'),
appBundleId: 'com.felixrieseberg.windows95',
appCategoryType: 'public.app-category.developer-tools',
@@ -19,21 +19,23 @@ module.exports = {
{
name: '@electron-forge/maker-squirrel',
platforms: ['win32'],
config: {
name: 'windows98',
authors: 'Felix Rieseberg',
exe: 'windows95.exe',
noMsi: true,
remoteReleases: '',
setupExe: `windows95-${package.version}-setup-${process.arch}.exe`,
setupIcon: path.resolve(__dirname, 'assets', 'icon.ico'),
certificateFile: process.env.WINDOWS_CERTIFICATE_FILE,
certificatePassword: process.env.WINDOWS_CERTIFICATE_PASSWORD
config: (arch) => {
return {
name: 'windows95',
authors: 'Felix Rieseberg',
exe: 'windows95.exe',
noMsi: true,
remoteReleases: '',
setupExe: `windows95-${package.version}-setup-${arch}.exe`,
setupIcon: path.resolve(__dirname, 'assets', 'icon.ico'),
certificateFile: process.env.WINDOWS_CERTIFICATE_FILE,
certificatePassword: process.env.WINDOWS_CERTIFICATE_PASSWORD
}
}
},
{
name: '@electron-forge/maker-zip',
platforms: ['darwin']
platforms: ['darwin', 'win32']
},
{
name: '@electron-forge/maker-deb',
@@ -43,5 +45,18 @@ module.exports = {
name: '@electron-forge/maker-rpm',
platforms: ['linux']
}
],
publishers: [
{
name: '@electron-forge/publisher-github',
config: {
repository: {
owner: 'felixrieseberg',
name: 'windows95'
},
draft: true,
prerelease: true
}
}
]
};

7
issue_template.md Normal file
View File

@@ -0,0 +1,7 @@
⚠️ Thank you for reporting an issue!
Before we go any further, understand that I probably won't be able to fullfil feature requests.
Feel free to report what feature you'd love to see, just don't get angry when I don't have
time to implement it 🙇‍♂️
I will however _gladly_ help you make a pull request if you're willing to play with Javascript!

3054
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
{
"name": "windows95",
"productName": "windows95",
"version": "1.1.0",
"version": "2.1.1",
"description": "Windows 95, in an app. I'm sorry.",
"main": "src/index.js",
"scripts": {
@@ -19,6 +19,7 @@
},
"standard": {
"globals": [
"appState",
"V86Starter",
"windows95"
],
@@ -27,17 +28,20 @@
]
},
"dependencies": {
"electron-default-menu": "^1.0.1",
"electron-squirrel-startup": "^1.0.0",
"fs-extra": "^7.0.0"
"fs-extra": "^8.0.1",
"update-electron-app": "^1.3.0"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.22",
"@electron-forge/maker-deb": "^6.0.0-beta.22",
"@electron-forge/maker-rpm": "^6.0.0-beta.22",
"@electron-forge/maker-squirrel": "^6.0.0-beta.22",
"@electron-forge/maker-zip": "^6.0.0-beta.22",
"electron": "3.0.0-beta.6",
"standard": "^11.0.1"
"@electron-forge/cli": "^6.0.0-beta.34",
"@electron-forge/maker-deb": "^6.0.0-beta.34",
"@electron-forge/maker-flatpak": "^6.0.0-beta.34",
"@electron-forge/maker-rpm": "^6.0.0-beta.34",
"@electron-forge/maker-squirrel": "^6.0.0-beta.34",
"@electron-forge/maker-zip": "^6.0.0-beta.34",
"@electron-forge/publisher-github": "^6.0.0-beta.34",
"electron": "5.0.1",
"node-abi": "^2.8.0",
"standard": "^12.0.1"
}
}

24
src/constants.js Normal file
View File

@@ -0,0 +1,24 @@
const { remote, app } = require('electron')
const path = require('path')
const _app = app || remote.app
const CONSTANTS = {
IMAGE_PATH: path.join(__dirname, 'images/windows95.img'),
IMAGE_DEFAULT_SIZE: 1073741824, // 1GB
DEFAULT_STATE_PATH: path.join(__dirname, 'images/default-state.bin'),
STATE_PATH: path.join(_app.getPath('userData'), 'state-v2.bin')
}
const IPC_COMMANDS = {
TOGGLE_INFO: 'TOGGLE_INFO',
MACHINE_RESTART: 'MACHINE_RESTART',
MACHINE_RESET: 'MACHINE_RESET',
MACHINE_CTRL_ALT_DEL: 'MACHINE_CTRL_ALT_DEL',
SHOW_DISK_IMAGE: 'SHOW_DISK_IMAGE'
}
module.exports = {
CONSTANTS,
IPC_COMMANDS
}

36
src/es6.js Normal file
View File

@@ -0,0 +1,36 @@
const { protocol } = require('electron')
const fs = require('fs-extra')
const path = require('path')
const ES6_PATH = path.join(__dirname, 'renderer')
protocol.registerSchemesAsPrivileged([
{
scheme: 'es6',
privileges: {
standard: true
}
}
])
async function setupProtocol () {
protocol.registerBufferProtocol('es6', async (req, cb) => {
console.log(req)
try {
const filePath = path.join(ES6_PATH, req.url.replace('es6://', ''))
.replace('.js/', '.js')
.replace('.js\\', '.js')
const fileContent = await fs.readFile(filePath)
cb({ mimeType: 'text/javascript', data: fileContent }) // eslint-disable-line
} catch (error) {
console.warn(error)
}
})
}
module.exports = {
setupProtocol
}

View File

@@ -1,28 +1,35 @@
const { app, BrowserWindow } = require('electron')
const path = require('path')
const { clearCaches } = require('./cache')
const { createMenu } = require('./menu')
const { setupProtocol } = require('./es6')
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
app.quit()
}
if (app.isPackaged) {
require('update-electron-app')({
repo: 'felixrieseberg/windows95',
updateInterval: '1 hour'
})
}
let mainWindow
const createWindow = () => {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 1280,
height: 800,
width: 1024,
height: 768,
useContentSize: true,
nodeIntegration: false,
webPreferences: {
nodeIntegration: false,
preload: path.join(__dirname, 'preload.js')
}
})
mainWindow.loadURL(`file://${__dirname}/renderer/index.html?system=win98`)
mainWindow.loadURL(`file://${__dirname}/renderer/index.html`)
mainWindow.on('closed', () => {
mainWindow = null
@@ -30,8 +37,9 @@ const createWindow = () => {
}
app.on('ready', async () => {
await setupProtocol()
await createMenu()
await clearCaches()
createWindow()
})

View File

@@ -1,10 +1,180 @@
const { app, shell, Menu } = require('electron')
const defaultMenu = require('electron-default-menu')
const { app, shell, Menu, BrowserWindow } = require('electron')
const { clearCaches } = require('./cache')
const { IPC_COMMANDS } = require('./constants')
const LINKS = {
homepage: 'https://www.twitter.com/felixrieseberg',
repo: 'https://github.com/felixrieseberg/windows95',
credits: 'https://github.com/felixrieseberg/windows95/blob/master/CREDITS.md',
help: 'https://github.com/felixrieseberg/windows95/blob/master/HELP.md'
}
function send (cmd) {
const windows = BrowserWindow.getAllWindows()
if (windows[0]) {
windows[0].webContents.send(cmd)
}
}
async function createMenu () {
const menu = defaultMenu(app, shell)
const template = [
{
label: 'View',
submenu: [
{
label: 'Toggle Full Screen',
accelerator: (function () {
if (process.platform === 'darwin') { return 'Ctrl+Command+F' } else { return 'F11' }
})(),
click: function (_item, focusedWindow) {
if (focusedWindow) { focusedWindow.setFullScreen(!focusedWindow.isFullScreen()) }
}
},
{
label: 'Toggle Developer Tools',
accelerator: (function () {
if (process.platform === 'darwin') { return 'Alt+Command+I' } else { return 'Ctrl+Shift+I' }
})(),
click: function (_item, focusedWindow) {
if (focusedWindow) { focusedWindow.toggleDevTools() }
}
},
{
type: 'separator'
},
{
label: 'Toggle Emulator Info',
click: () => send(IPC_COMMANDS.TOGGLE_INFO)
}
]
},
{
label: 'Window',
role: 'window',
submenu: [
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
}
]
},
{
label: 'Machine',
submenu: [
{
label: 'Send Ctrl+Alt+Del',
click: () => send(IPC_COMMANDS.MACHINE_CTRL_ALT_DEL)
},
{
label: 'Restart',
click: () => send(IPC_COMMANDS.MACHINE_RESTART)
},
{
label: 'Reset',
click: () => send(IPC_COMMANDS.MACHINE_RESET)
},
{
type: 'separator'
},
{
label: 'Go to Disk Image',
click: () => send(IPC_COMMANDS.SHOW_DISK_IMAGE)
}
]
},
{
label: 'Help',
role: 'help',
submenu: [
{
label: 'Author',
click: () => shell.openExternal(LINKS.homepage)
},
{
label: 'windows95 on GitHub',
click: () => shell.openExternal(LINKS.repo)
},
{
label: 'Help',
click: () => shell.openExternal(LINKS.help)
},
{
type: 'separator'
},
{
label: 'Troubleshooting',
submenu: [
{
label: 'Clear Cache and Restart',
async click () {
await clearCaches()
Menu.setApplicationMenu(Menu.buildFromTemplate(menu))
app.relaunch()
app.quit()
}
}
]
}
]
}
]
if (process.platform === 'darwin') {
template.unshift({
label: 'windows95',
submenu: [
{
label: 'About windows95',
role: 'about'
},
{
type: 'separator'
},
{
label: 'Services',
role: 'services',
submenu: []
},
{
type: 'separator'
},
{
label: 'Hide windows95',
accelerator: 'Command+H',
role: 'hide'
},
{
label: 'Hide Others',
accelerator: 'Command+Shift+H',
role: 'hideothers'
},
{
label: 'Show All',
role: 'unhide'
},
{
type: 'separator'
},
{
label: 'Quit',
accelerator: 'Command+Q',
click () {
app.quit()
}
}
]
})
}
Menu.setApplicationMenu(Menu.buildFromTemplate(template))
}
module.exports = {

View File

@@ -1,43 +1,42 @@
const { remote } = require('electron')
const fs = require('fs-extra')
const { remote, shell, ipcRenderer } = require('electron')
const path = require('path')
const EventEmitter = require('events')
const { STATE_PATH, getState, resetState } = require('./state')
const { resetState, restoreState, saveState } = require('./state')
const { getDiskImageSize } = require('./utils/disk-image-size')
const { IPC_COMMANDS, CONSTANTS } = require('./constants')
window.windows95 = {
STATE_PATH,
class Windows95 extends EventEmitter {
constructor () {
super()
resetState,
// Constants
this.CONSTANTS = CONSTANTS
this.IPC_COMMANDS = IPC_COMMANDS
async saveState () {
return new Promise((resolve) => {
if (!window.emulator || !window.emulator.save_state) {
return resolve()
}
// Methods
this.getDiskImageSize = getDiskImageSize
this.restoreState = restoreState
this.resetState = resetState
this.saveState = saveState
window.emulator.save_state(async (error, newState) => {
if (error) {
console.log(error)
return
}
await fs.outputFile(STATE_PATH, Buffer.from(newState))
console.log(`Saved state to ${STATE_PATH}`)
resolve()
Object.keys(IPC_COMMANDS).forEach((command) => {
ipcRenderer.on(command, (...args) => {
this.emit(command, args)
})
})
},
}
async restoreState () {
try {
window.emulator.restore_state(getState())
} catch (error) {
console.log(`Could not read state file. Maybe none exists?`, error)
}
},
showDiskImage () {
const imagePath = path.join(__dirname, 'images/windows95.img')
.replace('app.asar', 'app.asar.unpacked')
shell.showItemInFolder(imagePath)
}
quit () {
remote.app.quit()
}
}
window.windows95 = new Windows95()

View File

@@ -0,0 +1,9 @@
export function setupState () {
window.appState = {
isResetting: false,
isQuitting: false,
cursorCaptured: false,
floppyFile: null,
bootFresh: false
}
}

Binary file not shown.

Binary file not shown.

44
src/renderer/buttons.js Normal file
View File

@@ -0,0 +1,44 @@
const $ = document.querySelector.bind(document)
export function setupButtons (start) {
// Start
$('.btn-start').addEventListener('click', () => start())
// Disk Image
$('#show-disk-image').addEventListener('click', () => windows95.showDiskImage())
// Reset
$('#reset').addEventListener('click', () => windows95.resetState())
$('#discard-state').addEventListener('click', () => {
window.appState.bootFresh = true
start()
})
// Floppy
$('#floppy').addEventListener('click', () => {
$('#file-input').click()
})
// Floppy (Hidden Input)
$('#file-input').addEventListener('change', (event) => {
window.appState.floppyFile = event.target.files && event.target.files.length > 0
? event.target.files[0]
: null
if (window.appState.floppyFile) {
$('#floppy-path').innerHTML = `Inserted Floppy Disk: ${window.appState.floppyFile.path}`
}
})
}
export function toggleButtons (forceTo) {
const buttonElements = $('#buttons')
if (buttonElements.style.display !== 'none' || forceTo === false) {
buttonElements.style.display = 'none'
} else {
buttonElements.style.display = undefined
}
}

View File

@@ -11,6 +11,11 @@
</head>
<body class="paused">
<div id="status">
Disk: <span id="disk-status">Idle</span>
| CPU Speed: <span id="cpu-status">0</span>
| <a href="#" id="toggle-status">Hide</a>
</div>
<div id="buttons">
<div id="start-buttons">
<!-- <div class="btn" id="win98">Windows 98</div> -->
@@ -26,14 +31,15 @@
<div class="btn" id="reset">Reset Machine & Delete State</div>
<div class="btn" id="floppy">Insert Floppy Disk</div>
<div class="btn" id="discard-state">Discard State & Boot From Scratch</div>
<div class="btn" id="show-disk-image">Show Disk Image</div>
<input id="file-input" type='file'>
</div>
<div id="information">
<p id="floppy-path"></p>
<p>You can insert a floppy disk image with the ".img" format.</p>
<p>
Boot the machine from scratch if you've inserted a new floppy disk to
make sure that Windows can load it.
Boot the machine from scratch if you've inserted a new floppy disk
or if you've changed the disk image.
</p>
</div>
</div>
@@ -41,8 +47,8 @@
<div style="white-space: pre; font: 14px monospace; line-height: 14px"></div>
<canvas style="display: none"></canvas>
</div>
<script>
require('./renderer.js')
<script type="module">
import("es6://renderer.js")
</script>
</body>

94
src/renderer/info.js Normal file
View File

@@ -0,0 +1,94 @@
const $ = document.querySelector.bind(document)
const status = $('#status')
const diskStatus = $('#disk-status')
const cpuStatus = $('#cpu-status')
const toggleStatus = $('#toggle-status')
let lastCounter = 0
let lastTick = 0
let infoInterval = null
const onIDEReadStart = () => {
diskStatus.innerHTML = 'Read'
}
const onIDEReadWriteEnd = () => {
diskStatus.innerHTML = 'Idle'
}
toggleStatus.onclick = toggleInfo
/**
* Toggle the information display
*/
export function toggleInfo () {
if (status.style.display !== 'none') {
disableInfo()
} else {
enableInfo()
}
}
/**
* Start information gathering, but only if the panel is visible
*/
export function startInfoMaybe () {
if (status.style.display !== 'none') {
enableInfo()
}
}
/**
* Enable the gathering of information (and hide the little information tab)
*/
export function enableInfo () {
// Show the info thingy
status.style.display = 'block'
// We can only do the rest with an emulator
if (!window.emulator.add_listener) {
return
}
// Set listeners
window.emulator.add_listener('ide-read-start', onIDEReadStart)
window.emulator.add_listener('ide-read-end', onIDEReadWriteEnd)
window.emulator.add_listener('ide-write-end', onIDEReadWriteEnd)
window.emulator.add_listener('screen-set-size-graphical', console.log)
// Set an interval
infoInterval = setInterval(() => {
const now = Date.now()
const instructionCounter = window.emulator.get_instruction_counter()
const ips = instructionCounter - lastCounter
const deltaTime = now - lastTick
lastTick = now
lastCounter = instructionCounter
cpuStatus.innerHTML = Math.round(ips / deltaTime)
}, 500)
}
/**
* Disable the gathering of information (and hide the little information tab)
*/
export function disableInfo () {
// Hide the info thingy
status.style.display = 'none'
// Clear the interval
clearInterval(infoInterval)
infoInterval = null
// We can only do the rest with an emulator
if (!window.emulator.remove_listener) {
return
}
// Unset the listeners
window.emulator.remove_listener('ide-read-start', onIDEReadStart)
window.emulator.remove_listener('ide-read-end', onIDEReadWriteEnd)
window.emulator.remove_listener('ide-write-end', onIDEReadWriteEnd)
window.emulator.remove_listener('screen-set-size-graphical', console.log)
}

44
src/renderer/ipc.js Normal file
View File

@@ -0,0 +1,44 @@
import { toggleInfo } from 'es6://info.js'
export function setupIpcListeners (start) {
const { windows95 } = window
windows95.addListener(windows95.IPC_COMMANDS.TOGGLE_INFO, () => {
toggleInfo()
})
windows95.addListener(windows95.IPC_COMMANDS.MACHINE_RESTART, () => {
console.log(`Restarting machine`)
if (!window.emulator || !window.emulator.is_running) return
window.emulator.restart()
})
windows95.addListener(windows95.IPC_COMMANDS.MACHINE_RESET, () => {
console.log(`Resetting machine`)
window.appState.isResetting = true
document.location.hash = `#AUTO_START`
document.location.reload()
})
windows95.addListener(windows95.IPC_COMMANDS.MACHINE_CTRL_ALT_DEL, () => {
if (!window.emulator || !window.emulator.is_running) return
window.emulator.keyboard_send_scancodes([
0x1D, // ctrl
0x38, // alt
0x53, // delete
// break codes
0x1D | 0x80,
0x38 | 0x80,
0x53 | 0x80
])
})
windows95.addListener(windows95.IPC_COMMANDS.SHOW_DISK_IMAGE, () => {
windows95.showDiskImage()
})
}

View File

@@ -0,0 +1,26 @@
Copyright (c) 2012-2018, Fabian Hemmer
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.

47
src/renderer/listeners.js Normal file
View File

@@ -0,0 +1,47 @@
export function setupCloseListener () {
window.appState.isQuitting = false
const handleClose = async () => {
await windows95.saveState()
window.appState.isQuitting = true
windows95.quit()
}
window.onbeforeunload = (event) => {
if (window.appState.isQuitting) return
if (window.appState.isResetting) return
handleClose()
event.preventDefault()
event.returnValue = false
}
}
export function setupEscListener () {
document.onkeydown = function (evt) {
evt = evt || window.event
if (evt.keyCode === 27) {
if (window.appState.cursorCaptured) {
window.appState.cursorCaptured = false
window.emulator.mouse_set_status(false)
document.exitPointerLock()
} else {
window.appState.cursorCaptured = true
window.emulator.lock_mouse()
}
}
}
}
function onDocumentClick () {
if (!window.appState.cursorCaptured) {
window.appState.cursorCaptured = true
window.emulator.mouse_set_status(true)
window.emulator.lock_mouse()
}
}
export function setupClickListener () {
document.removeEventListener('click', onDocumentClick)
document.addEventListener('click', onDocumentClick)
}

View File

@@ -1,25 +1,20 @@
const $ = document.querySelector.bind(document)
const $$ = document.querySelectorAll.bind(document)
/* We're using modern esm imports here */
import { setupState } from 'es6://app-state.js'
import { setupClickListener, setupEscListener, setupCloseListener } from 'es6://listeners.js'
import { toggleButtons, setupButtons } from 'es6://buttons.js'
import { startInfoMaybe } from 'es6://info.js'
import { setupIpcListeners } from 'es6://ipc.js'
const BUTTONS = $('#buttons')
setupState()
let cursorCaptured = false
let floppyFile = null
let bootFresh = false
const OPTIONS = {
win95: {
hda: {
url: './images/windows95.img',
async: true,
size: 242049024
}
}
}
async function main (id) {
const opts = Object.assign({
memory_size: 64 * 1024 * 1024,
/**
* The main method executing the VM.
*/
async function main () {
const imageSize = await window.windows95.getDiskImageSize()
const options = {
memory_size: 128 * 1024 * 1024,
video_memory_size: 32 * 1024 * 1024,
screen_container: document.getElementById('emulator'),
bios: {
url: './bios/seabios.bin'
@@ -27,110 +22,51 @@ async function main (id) {
vga_bios: {
url: './bios/vgabios.bin'
},
hda: {
url: '../images/windows95.img',
async: true,
size: imageSize
},
fda: {
buffer: floppyFile || undefined
buffer: window.appState.floppyFile || undefined
},
boot_order: 0x132
}, OPTIONS[id])
}
console.log(`Starting emulator with options`, options)
// New v86 instance
window.emulator = new V86Starter(opts)
window.emulator = new V86Starter(options)
// Restore state. We can't do this right away.
// Restore state. We can't do this right away
// and randomly chose 500ms as the appropriate
// wait time (lol)
setTimeout(async () => {
if (!bootFresh) {
await windows95.restoreState()
if (!window.appState.bootFresh) {
windows95.restoreState()
}
cursorCaptured = true
startInfoMaybe()
window.appState.cursorCaptured = true
window.emulator.lock_mouse()
window.emulator.run()
}, 500)
}
function start (id) {
BUTTONS.remove()
function start () {
document.body.className = ''
main(id)
}
function setupButtons () {
// Start
$$('.btn-start').forEach((btn) => {
btn.addEventListener('click', () => start(btn.id))
})
// Reset
$('#reset').addEventListener('click', () => {
if (window.emulator.stop) {
window.emulator.stop()
}
windows95.resetState()
if (window.emulator.run) {
window.emulator.run()
}
$('#reset').disabled = true
})
$('#discard-state').addEventListener('click', () => {
bootFresh = true
start('win95')
})
// Floppy
$('#floppy').addEventListener('click', () => {
$('#file-input').click()
})
// Floppy (Hidden Input)
$('#file-input').addEventListener('change', (event) => {
floppyFile = event.target.files && event.target.files.length > 0
? event.target.files[0]
: null
if (floppyFile) {
$('#floppy-path').innerHTML = `Inserted Floppy Disk: ${floppyFile.path}`
}
})
}
function setupEscListener () {
document.onkeydown = function (evt) {
evt = evt || window.event
if (evt.keyCode === 27) {
if (cursorCaptured) {
cursorCaptured = false
document.exitPointerLock()
} else {
cursorCaptured = true
window.emulator.lock_mouse()
}
}
}
}
function setupCloseListener () {
let isQuitting = false
const handleClose = async () => {
await windows95.saveState()
isQuitting = true
windows95.quit()
}
window.onbeforeunload = (event) => {
if (isQuitting) return
handleClose()
event.preventDefault()
event.returnValue = false
}
toggleButtons(false)
setupClickListener()
main()
}
setupIpcListeners(start)
setupEscListener()
setupCloseListener()
setupButtons()
setupButtons(start)
if (document.location.hash.includes('AUTO_START')) {
start()
}

View File

@@ -16,6 +16,28 @@ body.paused {
font-family: Courier;
}
#buttons {
user-select: none;
}
#status {
user-select: none;
position: absolute;
z-index: 100;
left: calc(50vw - 110px);
background: white;
text-align: center;
font-family: Courier;
font-size: 10px;
padding-bottom: 3px;
border-bottom-left-radius: 15px;
border-bottom-right-radius: 15px;
overflow: hidden;
padding-left: 10px;
padding-right: 10px;
max-height: 18px;
}
#floppy-path {
background: beige;
padding: 5px;

View File

@@ -1,24 +1,81 @@
const fs = require('fs-extra')
const path = require('path')
const { remote } = require('electron')
const DEFAULT_PATH = path.join(__dirname, 'renderer/images/default-state.bin')
const STATE_PATH = path.join(remote.app.getPath('userData'), 'state.bin')
const { CONSTANTS } = require('./constants')
/**
* Returns the current machine's state - either what
* we have saved or alternatively the default state.
*
* @returns {ArrayBuffer}
*/
function getState () {
const statePath = fs.existsSync(STATE_PATH)
? STATE_PATH
: DEFAULT_PATH
const statePath = fs.existsSync(CONSTANTS.STATE_PATH)
? CONSTANTS.STATE_PATH
: CONSTANTS.DEFAULT_STATE_PATH
return fs.readFileSync(statePath).buffer
if (fs.existsSync(statePath)) {
return fs.readFileSync(statePath).buffer
}
}
function resetState () {
fs.removeSync(STATE_PATH)
/**
* Resets a saved state by simply deleting it.
*
* @returns {Promise<void>}
*/
async function resetState () {
if (fs.existsSync(CONSTANTS.STATE_PATH)) {
return fs.remove(CONSTANTS.STATE_PATH)
}
}
/**
* Saves the current VM's state.
*
* @returns {Promise<void>}
*/
async function saveState () {
return new Promise((resolve) => {
if (!window.emulator || !window.emulator.save_state) {
return resolve()
}
window.emulator.save_state(async (error, newState) => {
if (error) {
console.warn(`State: Could not save state`, error)
return
}
await fs.outputFile(CONSTANTS.STATE_PATH, Buffer.from(newState))
console.log(`State: Saved state to ${CONSTANTS.STATE_PATH}`)
resolve()
})
})
}
/**
* Restores the VM's state.
*/
function restoreState () {
const state = getState()
// Nothing to do with if we don't have a state
if (!state) {
console.log(`State: No state present, not restoring.`)
}
try {
window.emulator.restore_state(state)
} catch (error) {
console.log(`State: Could not read state file. Maybe none exists?`, error)
}
}
module.exports = {
STATE_PATH,
saveState,
restoreState,
resetState,
getState
}

View File

@@ -0,0 +1,26 @@
const fs = require('fs-extra')
const { CONSTANTS } = require('../constants')
/**
* Get the size of the disk image
*
* @returns {number}
*/
async function getDiskImageSize () {
try {
const stats = await fs.stat(CONSTANTS.IMAGE_PATH)
if (stats) {
return stats.size
}
} catch (error) {
console.warn(`Could not determine image size`, error)
}
return CONSTANTS.IMAGE_DEFAULT_SIZE
}
module.exports = {
getDiskImageSize
}