mirror of
https://github.com/felixrieseberg/macintosh.js.git
synced 2024-06-27 13:29:37 +00:00
Compare commits
55 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
6b84c60051 | ||
|
5cdaad84cc | ||
|
fb930035c7 | ||
|
b3991ef1d0 | ||
|
7dda450bf6 | ||
|
d68097b59b | ||
|
34eccc706c | ||
|
cc94f198e2 | ||
|
f5ef5da750 | ||
|
1482f6d443 | ||
|
1533ba7ec0 | ||
|
8a8aa0e7eb | ||
|
05136c28c1 | ||
|
e5b24cc04a | ||
|
d58444bc18 | ||
|
dc0b8fe19f | ||
|
895ce4c743 | ||
|
35b769949c | ||
|
4acf8bb312 | ||
|
8821a4749f | ||
|
4d57fc494c | ||
|
ede11165a9 | ||
|
bdb1033958 | ||
|
78411c9fa4 | ||
|
47aba5bb36 | ||
|
da495a9b39 | ||
|
c30866e58e | ||
|
6c1ffff0e0 | ||
|
e3c6d96785 | ||
|
60a3e787f5 | ||
|
57ad789c61 | ||
|
47863bb45e | ||
|
9c98bf1eb8 | ||
|
6df468db4d | ||
|
5320b29eed | ||
|
d5688df03f | ||
|
e121c457af | ||
|
45d061f051 | ||
|
d9a0353091 | ||
|
9622100513 | ||
|
55b97251a0 | ||
|
576200b489 | ||
|
da7c0b1513 | ||
|
f2d8191b0d | ||
|
3bd800d296 | ||
|
5e9570023b | ||
|
64d8f4a382 | ||
|
de601111f9 | ||
|
5c83088633 | ||
|
c73331bf6a | ||
|
9a1bbd40fb | ||
|
1861b3b818 | ||
|
99c4e2e31c | ||
|
ec32c63b29 | ||
|
09f4a9a3ed |
3
.gitattributes
vendored
3
.gitattributes
vendored
|
@ -1 +1,2 @@
|
||||||
* text eol=lf
|
text eol=lf
|
||||||
|
rom -text
|
BIN
.github/images/linux.png
vendored
Normal file
BIN
.github/images/linux.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.7 KiB |
BIN
.github/images/macos.png
vendored
Normal file
BIN
.github/images/macos.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 23 KiB |
BIN
.github/images/windows.png
vendored
Normal file
BIN
.github/images/windows.png
vendored
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
52
.github/workflows/build.yml
vendored
52
.github/workflows/build.yml
vendored
|
@ -3,24 +3,24 @@ name: Build & Release
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
# - master
|
- master
|
||||||
tags:
|
tags:
|
||||||
- v*
|
- v*
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: lts/*
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v3
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||||
with:
|
with:
|
||||||
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
||||||
|
@ -28,26 +28,42 @@ jobs:
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-yarn-
|
${{ runner.os }}-yarn-
|
||||||
- name: Install
|
- name: Install
|
||||||
run: yarn
|
run: yarn --frozen-lockfile
|
||||||
- name: lint
|
- name: lint
|
||||||
run: yarn lint
|
run: yarn lint
|
||||||
build:
|
build:
|
||||||
needs: lint
|
needs: lint
|
||||||
name: Build (${{ matrix.os }})
|
name: Build (${{ matrix.os }} - ${{ matrix.arch }})
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ macOS-latest, ubuntu-latest, windows-latest ]
|
# Build for supported platforms
|
||||||
|
# https://github.com/electron/electron-packager/blob/ebcbd439ff3e0f6f92fa880ff28a8670a9bcf2ab/src/targets.js#L9
|
||||||
|
# 32-bit Linux unsupported as of 2019: https://www.electronjs.org/blog/linux-32bit-support
|
||||||
|
os: [ macOS-latest, ubuntu-20.04, windows-latest ]
|
||||||
|
arch: [ x64, arm64 ]
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
arch: ia32
|
||||||
|
- os: ubuntu-20.04
|
||||||
|
arch: armv7l
|
||||||
|
# Publishing artifacts for multiple Windows architectures has
|
||||||
|
# a bug which can cause the wrong architecture to be downloaded
|
||||||
|
# for an update, so until that is fixed, only build Windows x64
|
||||||
|
exclude:
|
||||||
|
- os: windows-latest
|
||||||
|
arch: arm64
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Setup Node.js
|
- name: Setup Node.js
|
||||||
uses: actions/setup-node@v1
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 12.x
|
node-version: lts/*
|
||||||
- name: Get yarn cache directory path
|
- name: Get yarn cache directory path
|
||||||
id: yarn-cache-dir-path
|
id: yarn-cache-dir-path
|
||||||
run: echo "::set-output name=dir::$(yarn cache dir)"
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
||||||
- uses: actions/cache@v1
|
- uses: actions/cache@v3
|
||||||
if: matrix.os != 'macOS-latest'
|
if: matrix.os != 'macOS-latest'
|
||||||
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
|
||||||
with:
|
with:
|
||||||
|
@ -63,6 +79,7 @@ jobs:
|
||||||
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
|
MACOS_CERT_PASSWORD: ${{ secrets.MACOS_CERT_PASSWORD }}
|
||||||
- name: Set Windows signing certificate
|
- name: Set Windows signing certificate
|
||||||
if: matrix.os == 'windows-latest'
|
if: matrix.os == 'windows-latest'
|
||||||
|
continue-on-error: true
|
||||||
id: write_file
|
id: write_file
|
||||||
uses: timheuer/base64-to-file@v1
|
uses: timheuer/base64-to-file@v1
|
||||||
with:
|
with:
|
||||||
|
@ -82,18 +99,12 @@ jobs:
|
||||||
run: yarn
|
run: yarn
|
||||||
- name: Make
|
- name: Make
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
run: yarn make
|
run: yarn make --arch=${{ matrix.arch }}
|
||||||
env:
|
env:
|
||||||
APPLE_ID: ${{ secrets.APPLE_ID }}
|
APPLE_ID: ${{ secrets.APPLE_ID }}
|
||||||
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}
|
||||||
WINDOWS_CODESIGN_FILE: ${{ steps.write_file.outputs.filePath }}
|
WINDOWS_CODESIGN_FILE: ${{ steps.write_file.outputs.filePath }}
|
||||||
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
|
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
|
||||||
- name: Make (ia32)
|
|
||||||
if: matrix.os == 'windows-latest' && startsWith(github.ref, 'refs/tags/')
|
|
||||||
run: yarn make -- --arch=ia32
|
|
||||||
env:
|
|
||||||
WINDOWS_CODESIGN_FILE: ${{ steps.write_file.outputs.filePath }}
|
|
||||||
WINDOWS_CODESIGN_PASSWORD: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
|
|
||||||
# - name: Archive production artifacts
|
# - name: Archive production artifacts
|
||||||
# uses: actions/upload-artifact@v2
|
# uses: actions/upload-artifact@v2
|
||||||
# with:
|
# with:
|
||||||
|
@ -105,6 +116,7 @@ jobs:
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
with:
|
with:
|
||||||
|
draft: true
|
||||||
files: |
|
files: |
|
||||||
out/**/*.deb
|
out/**/*.deb
|
||||||
out/**/*.dmg
|
out/**/*.dmg
|
||||||
|
|
97
README.md
97
README.md
|
@ -6,10 +6,97 @@ This is Mac OS 8, running in an [Electron](https://electronjs.org/) app pretendi
|
||||||
|
|
||||||
## Downloads
|
## Downloads
|
||||||
|
|
||||||
| | Windows | macOS | Linux |
|
<table class="is-fullwidth">
|
||||||
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
</thead>
|
||||||
| Standalone Download | 📦[Standalone, 32-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintosh.js-win32-ia32-1.0.4.zip) <br /> 📦[Standalone, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintosh.js-win32-x64-1.0.4.zip) | 📦[Standalone](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintosh.js-darwin-x64-1.0.4.zip) | |
|
<tbody>
|
||||||
| Installer | 💽[Setup, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintoshjs-1.0.4-setup-x64.exe) <br /> 💽[Setup, 32-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintoshjs-1.0.4-setup-ia32.exe) | | 💽[deb, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintosh.js_1.0.4_amd64.deb) <br /> 💽[rpm, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.4/macintosh.js-1.0.4-1.x86_64.rpm) |
|
</tbody>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="./.github/images/windows.png" width="24"><br />
|
||||||
|
Windows
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>32-bit</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.2.0/macintoshjs-1.2.0-setup-ia32.exe">
|
||||||
|
💿 Installer
|
||||||
|
</a> |
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.2.0/macintosh.js-win32-ia32-1.2.0.zip">
|
||||||
|
📦 Standalone Zip
|
||||||
|
</a>
|
||||||
|
<br />
|
||||||
|
<span>64-bit</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.2.0/macintoshjs-1.2.0-setup-x64.exe">
|
||||||
|
💿 Installer
|
||||||
|
</a> |
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.2.0/macintosh.js-win32-x64-1.2.0.zip">
|
||||||
|
📦 Standalone Zip
|
||||||
|
</a><br />
|
||||||
|
<span>
|
||||||
|
❓ Don't know what kind of chip you have? Hit start, enter "processor" for info.
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="./.github/images/macos.png" width="24"><br />
|
||||||
|
macOS
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>Intel Processor</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js-darwin-x64-1.1.0.zip">
|
||||||
|
📦 Standalone Zip
|
||||||
|
</a><br />
|
||||||
|
<span>Apple M1 Processor</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js-darwin-arm64-1.1.0.zip">
|
||||||
|
📦 Standalone Zip
|
||||||
|
</a><br />
|
||||||
|
<span>
|
||||||
|
❓ Don't know what kind of chip you have? Learn more at <a href="https://support.apple.com/en-us/HT211814">apple.com</a>.
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<img src="./.github/images/linux.png" width="24"><br />
|
||||||
|
Linux
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<span>32-bit</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js-1.1.0-1.i386.rpm">
|
||||||
|
💿 rpm
|
||||||
|
</a> |
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js_1.1.0_i386.deb">
|
||||||
|
💿 deb
|
||||||
|
</a><br />
|
||||||
|
<span>64-bit</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js-1.1.0-1.x86_64.rpm">
|
||||||
|
💿 rpm
|
||||||
|
</a> |
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js_1.1.0_amd64.deb">
|
||||||
|
💿 deb
|
||||||
|
</a><br />
|
||||||
|
<span>ARM64</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js-1.1.0-1.arm64.rpm">
|
||||||
|
💿 rpm
|
||||||
|
</a> |
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js_1.1.0_arm64.deb">
|
||||||
|
💿 deb
|
||||||
|
</a><br />
|
||||||
|
<span>ARMv7 (armhf)</span>
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js-1.1.0-1.armv7hl.rpm">
|
||||||
|
💿 rpm
|
||||||
|
</a> |
|
||||||
|
<a href="https://github.com/felixrieseberg/macintosh.js/releases/download/v1.1.0/macintosh.js_1.1.0_armhf.deb">
|
||||||
|
💿 deb
|
||||||
|
</a><br />
|
||||||
|
<span>
|
||||||
|
❓ Don't know what kind of chip you have? Run `uname -m` in the console.
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
|
||||||
## Does it work?
|
## 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. The virtual machine is emulating a 1991 Macintosh Quadra 900 with a Motorola CPU, which Apple used before switching to the PowerPC architecture (Apple/IBM/Motorola) in the mid 1990s.
|
Yes! Quite well, actually - on macOS, Windows, and Linux. Bear in mind that this is written entirely in JavaScript, so please adjust your expectations. The virtual machine is emulating a 1991 Macintosh Quadra 900 with a Motorola CPU, which Apple used before switching to the PowerPC architecture (Apple/IBM/Motorola) in the mid 1990s.
|
||||||
|
@ -36,7 +123,7 @@ Probably not. This is a toy - it's not the best nor the most performant way to e
|
||||||
|
|
||||||
## Credits
|
## Credits
|
||||||
|
|
||||||
Please check out the [CREDITS](CREDITS.md)! This app wouldn't be possible with the hard work of [Christian Bauer](https://www.cebix.net/) and [James Friend](https://jamesfriend.com.au/), who did everything that seems like computing magic here.
|
Please check out the [CREDITS](CREDITS.md)! This app wouldn't be possible without the hard work of [Christian Bauer](https://www.cebix.net/) and [James Friend](https://jamesfriend.com.au/), who did everything that seems like computing magic here.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
Binary file not shown.
Binary file not shown.
22
package.json
22
package.json
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "macintosh.js",
|
"name": "macintosh.js",
|
||||||
"productName": "macintosh.js",
|
"productName": "macintosh.js",
|
||||||
"version": "1.0.5",
|
"version": "1.2.0",
|
||||||
"description": "Macintosh's System 8 in an Electron app. I'm sorry.",
|
"description": "Macintosh's System 8 in an Electron app. I'm sorry.",
|
||||||
"main": "src/main/index.js",
|
"main": "src/main/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -9,8 +9,9 @@
|
||||||
"package": "electron-forge package",
|
"package": "electron-forge package",
|
||||||
"make": "electron-forge make",
|
"make": "electron-forge make",
|
||||||
"publish": "electron-forge publish",
|
"publish": "electron-forge publish",
|
||||||
"lint": "npx prettier --check src/{main,renderer}/*.{js,css}",
|
"lint": "npx prettier --check src/{main,renderer}/*.{js,css} && npm run check-links",
|
||||||
"fix": "npx prettier --write src/{main,renderer}/*.{js,css}"
|
"fix": "npx prettier --write \"src/{main,renderer}/**.{js,css}\"",
|
||||||
|
"check-links": "node tools/check-links.js"
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": {
|
"author": {
|
||||||
|
@ -23,14 +24,15 @@
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"electron-squirrel-startup": "^1.0.0",
|
"electron-squirrel-startup": "^1.0.0",
|
||||||
"update-electron-app": "^1.5.0"
|
"update-electron-app": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@electron-forge/cli": "6.0.0-beta.52",
|
"@electron-forge/cli": "6.0.5",
|
||||||
"@electron-forge/maker-deb": "6.0.0-beta.52",
|
"@electron-forge/maker-deb": "6.0.5",
|
||||||
"@electron-forge/maker-rpm": "6.0.0-beta.52",
|
"@electron-forge/maker-rpm": "6.0.5",
|
||||||
"@electron-forge/maker-squirrel": "6.0.0-beta.52",
|
"@electron-forge/maker-squirrel": "6.0.5",
|
||||||
"@electron-forge/maker-zip": "6.0.0-beta.52",
|
"@electron-forge/maker-zip": "6.0.5",
|
||||||
"electron": "10.0.0-beta.12"
|
"electron": "23.1.3",
|
||||||
|
"node-fetch": "^2.6.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { error } = require("console");
|
|
||||||
|
|
||||||
const homeDir = require("os").homedir();
|
const homeDir = require("os").homedir();
|
||||||
const macDir = path.join(homeDir, "macintosh.js");
|
const macDir = path.join(homeDir, "macintosh.js");
|
||||||
|
@ -13,6 +12,24 @@ function getUserDataDiskPath() {
|
||||||
return path.join(userDataPath, "disk");
|
return path.join(userDataPath, "disk");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// File type utilities
|
||||||
|
|
||||||
|
function isFile(v = "") {
|
||||||
|
return fs.statSync(path.join(macDir, v)).isFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
function isHiddenFile(filename = '') {
|
||||||
|
return filename.startsWith('.');
|
||||||
|
}
|
||||||
|
|
||||||
|
function isCDImage(filename = '') {
|
||||||
|
return filename.endsWith('.iso') || filename.endsWith('.toast');
|
||||||
|
}
|
||||||
|
|
||||||
|
function isDiskImage(filename = '') {
|
||||||
|
return filename.endsWith('.img') || filename.endsWith('.dsk') || filename.endsWith('.hda');
|
||||||
|
}
|
||||||
|
|
||||||
function cleanupCopyPath() {
|
function cleanupCopyPath() {
|
||||||
try {
|
try {
|
||||||
if (fs.existsSync(macintoshCopyPath)) {
|
if (fs.existsSync(macintoshCopyPath)) {
|
||||||
|
@ -60,7 +77,7 @@ function preloadFilesAtPath(module, initalSourcePath) {
|
||||||
}`;
|
}`;
|
||||||
const files = fs.readdirSync(sourcePath).filter((v) => {
|
const files = fs.readdirSync(sourcePath).filter((v) => {
|
||||||
// Remove hidden, iso, and img files
|
// Remove hidden, iso, and img files
|
||||||
return !v.startsWith(".") && !v.endsWith(".iso") && !v.endsWith(".img");
|
return !isHiddenFile(v) && !isDiskImage(v) && !isCDImage(v);
|
||||||
});
|
});
|
||||||
|
|
||||||
(files || []).forEach((fileName) => {
|
(files || []).forEach((fileName) => {
|
||||||
|
@ -192,9 +209,9 @@ function writePrefs(userImages = []) {
|
||||||
if (userImages && userImages.length > 0) {
|
if (userImages && userImages.length > 0) {
|
||||||
console.log(`writePrefs: Found ${userImages.length} user images`);
|
console.log(`writePrefs: Found ${userImages.length} user images`);
|
||||||
userImages.forEach(({ name }) => {
|
userImages.forEach(({ name }) => {
|
||||||
if (name.endsWith(".iso")) {
|
if (isCDImage(name)) {
|
||||||
prefs += `\ncdrom ${name}`;
|
prefs += `\ncdrom ${name}`;
|
||||||
} else if (name.endsWith(".img")) {
|
} else if (isDiskImage(name)) {
|
||||||
prefs += `\ndisk ${name}`;
|
prefs += `\ndisk ${name}`;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -208,14 +225,6 @@ function writePrefs(userImages = []) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isMacDirFileOfType(extension = "", v = "") {
|
|
||||||
const isType = v.endsWith(`.${extension}`);
|
|
||||||
const isMatch = isType && fs.statSync(path.join(macDir, v)).isFile();
|
|
||||||
|
|
||||||
console.log(`isMacDirFileOfType: ${v} is file and ${extension}: ${isMatch}`);
|
|
||||||
return isMatch;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getUserImages() {
|
function getUserImages() {
|
||||||
const result = [];
|
const result = [];
|
||||||
|
|
||||||
|
@ -227,8 +236,8 @@ function getUserImages() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const macDirFiles = fs.readdirSync(macDir);
|
const macDirFiles = fs.readdirSync(macDir);
|
||||||
const imgFiles = macDirFiles.filter((v) => isMacDirFileOfType("img", v));
|
const imgFiles = macDirFiles.filter((v) => isFile(v) && isDiskImage(v));
|
||||||
const isoFiles = macDirFiles.filter((v) => isMacDirFileOfType("iso", v));
|
const isoFiles = macDirFiles.filter((v) => isFile(v) && isCDImage(v));
|
||||||
const isoImgFiles = [...isoFiles, ...imgFiles];
|
const isoImgFiles = [...isoFiles, ...imgFiles];
|
||||||
|
|
||||||
console.log(`getUserImages: iso and img files`, isoImgFiles);
|
console.log(`getUserImages: iso and img files`, isoImgFiles);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const { app, dialog } = require("electron");
|
const { app, dialog } = require("electron");
|
||||||
|
const { getIsDevMode } = require("./devmode");
|
||||||
|
|
||||||
// If the app doesn't run from the /Applications folder,
|
// If the app doesn't run from the /Applications folder,
|
||||||
// we don't get to create files, which keeps the emulator from
|
// we don't get to create files, which keeps the emulator from
|
||||||
|
@ -8,6 +9,10 @@ function moveToAppFolderMaybe() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getIsDevMode()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (app.isInApplicationsFolder()) {
|
if (app.isInApplicationsFolder()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
const { app, BrowserWindow, shell } = require("electron");
|
const { BrowserWindow, shell } = require("electron");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
const { getIsDevMode } = require("./devmode");
|
const { getIsDevMode } = require("./devmode");
|
||||||
|
@ -61,18 +61,31 @@ function createWindow() {
|
||||||
width: 900,
|
width: 900,
|
||||||
height: 730,
|
height: 730,
|
||||||
useContentSize: true,
|
useContentSize: true,
|
||||||
frame: false,
|
frame: true,
|
||||||
transparent: true,
|
transparent: true,
|
||||||
resizable: false,
|
resizable: true,
|
||||||
webPreferences: {
|
webPreferences: {
|
||||||
nodeIntegration: true,
|
nodeIntegration: true,
|
||||||
|
nodeIntegrationInWorker: true,
|
||||||
nativeWindowOpen: true,
|
nativeWindowOpen: true,
|
||||||
|
contextIsolation: false,
|
||||||
navigateOnDragDrop: false,
|
navigateOnDragDrop: false,
|
||||||
nodeIntegrationInWorker: true,
|
nodeIntegrationInWorker: true,
|
||||||
sandbox: false,
|
sandbox: false,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Ensure that we have access to SharedArrayBuffer
|
||||||
|
mainWindow.webContents.session.webRequest.onHeadersReceived(
|
||||||
|
(details, callback) => {
|
||||||
|
details.responseHeaders["Cross-Origin-Opener-Policy"] = ["same-origin"];
|
||||||
|
details.responseHeaders["Cross-Origin-Embedder-Policy"] = [
|
||||||
|
"require-corp",
|
||||||
|
];
|
||||||
|
callback({ responseHeaders: details.responseHeaders });
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// and load the index.html of the app.
|
// and load the index.html of the app.
|
||||||
mainWindow.loadFile(path.join(__dirname, "../renderer/index.html"));
|
mainWindow.loadFile(path.join(__dirname, "../renderer/index.html"));
|
||||||
|
|
||||||
|
|
|
@ -1,43 +1,63 @@
|
||||||
const { videoModeBufferView } = require("./video");
|
const { videoModeBufferView } = require("./video");
|
||||||
const { audioContext } = require("./audio");
|
const BITS = 4;
|
||||||
|
const SCREEN_BUFFER_SIZE = 800 * 600 * BITS; // 32bpp;
|
||||||
const SCREEN_WIDTH = 800;
|
|
||||||
const SCREEN_HEIGHT = 600;
|
|
||||||
const SCREEN_BUFFER_SIZE = SCREEN_WIDTH * SCREEN_HEIGHT * 4; // 32bpp;
|
|
||||||
|
|
||||||
const screenBuffer = new SharedArrayBuffer(SCREEN_BUFFER_SIZE);
|
const screenBuffer = new SharedArrayBuffer(SCREEN_BUFFER_SIZE);
|
||||||
const screenBufferView = new Uint8Array(screenBuffer);
|
const screenBufferView = new Uint8Array(screenBuffer);
|
||||||
|
|
||||||
canvas.width = SCREEN_WIDTH;
|
let screenWidth = 800;
|
||||||
canvas.height = SCREEN_HEIGHT;
|
let screenHeight = 600;
|
||||||
|
|
||||||
|
canvas.width = screenWidth;
|
||||||
|
canvas.height = screenHeight;
|
||||||
|
|
||||||
const canvasCtx = canvas.getContext("2d");
|
const canvasCtx = canvas.getContext("2d");
|
||||||
const imageData = canvasCtx.createImageData(SCREEN_WIDTH, SCREEN_HEIGHT);
|
let imageData = canvasCtx.createImageData(screenWidth, screenHeight);
|
||||||
|
|
||||||
|
window.addEventListener("resize", () => {
|
||||||
|
screenHeight = window.innerHeight - 35;
|
||||||
|
screenWidth = Math.floor(screenHeight * (4 / 3));
|
||||||
|
if (window.innerWidth < screenWidth) {
|
||||||
|
screenWidth = window.innerWidth;
|
||||||
|
screenHeight = Math.floor(screenWidth * 0.75);
|
||||||
|
}
|
||||||
|
canvas.width = screenWidth;
|
||||||
|
canvas.height = screenHeight;
|
||||||
|
imageData = canvasCtx.createImageData(screenWidth, screenHeight);
|
||||||
|
});
|
||||||
|
|
||||||
let stopDrawing = false;
|
let stopDrawing = false;
|
||||||
|
|
||||||
function drawScreen() {
|
function drawScreen() {
|
||||||
if (stopDrawing) return;
|
if (stopDrawing) return;
|
||||||
const pixelsRGBA = imageData.data;
|
const pixelsRGBA = imageData.data;
|
||||||
const numPixels = SCREEN_WIDTH * SCREEN_HEIGHT;
|
const numPixels = screenWidth * screenHeight;
|
||||||
const expandedFromPalettedMode = videoModeBufferView[3];
|
const expandedFromPalettedMode = videoModeBufferView[3];
|
||||||
const start = audioContext.currentTime;
|
|
||||||
|
|
||||||
if (expandedFromPalettedMode) {
|
if (expandedFromPalettedMode) {
|
||||||
for (var i = 0; i < numPixels; i++) {
|
for (let i = 0; i < numPixels; i++) {
|
||||||
// palette
|
// palette
|
||||||
pixelsRGBA[i * 4 + 0] = screenBufferView[i * 4 + 0];
|
pixelsRGBA[i * BITS + 0] = screenBufferView[i * BITS + 0];
|
||||||
pixelsRGBA[i * 4 + 1] = screenBufferView[i * 4 + 1];
|
pixelsRGBA[i * BITS + 1] = screenBufferView[i * BITS + 1];
|
||||||
pixelsRGBA[i * 4 + 2] = screenBufferView[i * 4 + 2];
|
pixelsRGBA[i * BITS + 2] = screenBufferView[i * BITS + 2];
|
||||||
pixelsRGBA[i * 4 + 3] = 255; // full opacity
|
pixelsRGBA[i * BITS + 3] = 255; // full opacity
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var i = 0; i < numPixels; i++) {
|
for (let i = 0; i < screenHeight; i++) {
|
||||||
// ARGB
|
for (let j = 0; j < screenWidth; j++) {
|
||||||
pixelsRGBA[i * 4 + 0] = screenBufferView[i * 4 + 1];
|
// ARGB
|
||||||
pixelsRGBA[i * 4 + 1] = screenBufferView[i * 4 + 2];
|
const xRatio = 800 / screenWidth;
|
||||||
pixelsRGBA[i * 4 + 2] = screenBufferView[i * 4 + 3];
|
const yRatio = 600 / screenHeight;
|
||||||
pixelsRGBA[i * 4 + 3] = 255; // full opacity
|
const px = Math.floor(j * xRatio);
|
||||||
|
const py = Math.floor(i * yRatio);
|
||||||
|
pixelsRGBA[(i * screenWidth + j) * 4 + 0] =
|
||||||
|
screenBufferView[(py * 800 + px) * 4 + 1]; //- lineMult];
|
||||||
|
pixelsRGBA[(i * screenWidth + j) * 4 + 1] =
|
||||||
|
screenBufferView[(py * 800 + px) * 4 + 2]; //- lineMult];
|
||||||
|
pixelsRGBA[(i * screenWidth + j) * 4 + 2] =
|
||||||
|
screenBufferView[(py * 800 + px) * 4 + 3]; //- lineMult];
|
||||||
|
pixelsRGBA[(i * screenWidth + j) * 4 + 3] = 255; // full opacity
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +89,7 @@ module.exports = {
|
||||||
screenBufferView,
|
screenBufferView,
|
||||||
SCREEN_BUFFER_SIZE,
|
SCREEN_BUFFER_SIZE,
|
||||||
drawScreen,
|
drawScreen,
|
||||||
SCREEN_WIDTH,
|
SCREEN_WIDTH: screenWidth,
|
||||||
SCREEN_HEIGHT,
|
SCREEN_HEIGHT: screenHeight,
|
||||||
setCanvasBlank,
|
setCanvasBlank,
|
||||||
};
|
};
|
||||||
|
|
38
tools/check-links.js
Normal file
38
tools/check-links.js
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
const fs = require('fs/promises')
|
||||||
|
const path = require('path')
|
||||||
|
const fetch = require('node-fetch')
|
||||||
|
|
||||||
|
const LINK_RGX = /(http|ftp|https):\/\/([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?/g;
|
||||||
|
|
||||||
|
async function main() {
|
||||||
|
const readmePath = path.join(__dirname, '../README.md')
|
||||||
|
const readme = await fs.readFile(readmePath, 'utf-8')
|
||||||
|
const links = readme.match(LINK_RGX)
|
||||||
|
let failed = false
|
||||||
|
|
||||||
|
for (const link of links) {
|
||||||
|
try {
|
||||||
|
const response = await fetch(link, { method: 'HEAD' })
|
||||||
|
|
||||||
|
if (!response.ok) {
|
||||||
|
// If we're inside GitHub's release asset server, we just ran into AWS not allowing
|
||||||
|
// HEAD requests, which is different from a 404.
|
||||||
|
if (!response.url.startsWith('https://github-production-release-asset')) {
|
||||||
|
throw new Error (`HTTP Error Response: ${response.status} ${response.statusText}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(`✅ ${link}`);
|
||||||
|
} catch (error) {
|
||||||
|
failed = true
|
||||||
|
|
||||||
|
console.log(`❌ ${link}\n${error}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (failed) {
|
||||||
|
process.exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
Loading…
Reference in New Issue
Block a user