Compare commits

..

No commits in common. "master" and "v1.1.0" have entirely different histories.

12 changed files with 1591 additions and 1304 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -10,17 +10,17 @@ on:
jobs:
lint:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v1
with:
node-version: lts/*
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
@ -28,42 +28,26 @@ jobs:
restore-keys: |
${{ runner.os }}-yarn-
- name: Install
run: yarn --frozen-lockfile
run: yarn
- name: lint
run: yarn lint
build:
needs: lint
name: Build (${{ matrix.os }} - ${{ matrix.arch }})
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
# 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
os: [ macOS-latest, ubuntu-latest, windows-latest ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v1
with:
node-version: lts/*
node-version: 12.x
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v3
- uses: actions/cache@v1
if: matrix.os != 'macOS-latest'
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
@ -99,7 +83,7 @@ jobs:
run: yarn
- name: Make
if: startsWith(github.ref, 'refs/tags/')
run: yarn make --arch=${{ matrix.arch }}
run: yarn make --arch=all
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ID_PASSWORD: ${{ secrets.APPLE_ID_PASSWORD }}

View File

@ -6,97 +6,10 @@ This is Mac OS 8, running in an [Electron](https://electronjs.org/) app pretendi
## Downloads
<table class="is-fullwidth">
</thead>
<tbody>
</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 />
| | Windows | macOS | Linux |
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Standalone Download | 📦[Standalone, 32-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintosh.js-win32-ia32-1.0.6.zip) <br /> 📦[Standalone, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintosh.js-win32-x64-1.0.6.zip) | 📦[Standalone](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintosh.js-darwin-x64-1.0.6.zip) | |
| Installer | 💽[Setup, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintoshjs-1.0.6-setup-x64.exe) <br /> 💽[Setup, 32-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintoshjs-1.0.6-setup-ia32.exe) | | 💽[deb, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintosh.js_1.0.6_amd64.deb) <br /> 💽[rpm, 64-bit](https://github.com/felixrieseberg/macintosh.js/releases/download/v1.0.6/macintosh.js-1.0.6-1.x86_64.rpm) |
## 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.

View File

@ -1,7 +1,7 @@
{
"name": "macintosh.js",
"productName": "macintosh.js",
"version": "1.2.0",
"version": "1.1.0",
"description": "Macintosh's System 8 in an Electron app. I'm sorry.",
"main": "src/main/index.js",
"scripts": {
@ -9,9 +9,8 @@
"package": "electron-forge package",
"make": "electron-forge make",
"publish": "electron-forge publish",
"lint": "npx prettier --check src/{main,renderer}/*.{js,css} && npm run check-links",
"fix": "npx prettier --write \"src/{main,renderer}/**.{js,css}\"",
"check-links": "node tools/check-links.js"
"lint": "npx prettier --check src/{main,renderer}/*.{js,css}",
"fix": "npx prettier --write src/{main,renderer}/*.{js,css}"
},
"keywords": [],
"author": {
@ -27,12 +26,11 @@
"update-electron-app": "^2.0.1"
},
"devDependencies": {
"@electron-forge/cli": "6.0.5",
"@electron-forge/maker-deb": "6.0.5",
"@electron-forge/maker-rpm": "6.0.5",
"@electron-forge/maker-squirrel": "6.0.5",
"@electron-forge/maker-zip": "6.0.5",
"electron": "23.1.3",
"node-fetch": "^2.6.1"
"@electron-forge/cli": "6.0.0-beta.54",
"@electron-forge/maker-deb": "6.0.0-beta.54",
"@electron-forge/maker-rpm": "6.0.0-beta.54",
"@electron-forge/maker-squirrel": "6.0.0-beta.54",
"@electron-forge/maker-zip": "6.0.0-beta.54",
"electron": "11.1.1"
}
}

View File

@ -27,7 +27,7 @@ function isCDImage(filename = '') {
}
function isDiskImage(filename = '') {
return filename.endsWith('.img') || filename.endsWith('.dsk') || filename.endsWith('.hda');
return filename.endsWith('.img') || filename.endsWith('.dsk');
}
function cleanupCopyPath() {

View File

@ -1,5 +1,4 @@
const { app, dialog } = require("electron");
const { getIsDevMode } = require("./devmode");
// If the app doesn't run from the /Applications folder,
// we don't get to create files, which keeps the emulator from
@ -9,10 +8,6 @@ function moveToAppFolderMaybe() {
return;
}
if (getIsDevMode()) {
return;
}
if (app.isInApplicationsFolder()) {
return;
}

View File

@ -1,4 +1,4 @@
const { BrowserWindow, shell } = require("electron");
const { app, BrowserWindow, shell } = require("electron");
const path = require("path");
const { getIsDevMode } = require("./devmode");
@ -61,31 +61,18 @@ function createWindow() {
width: 900,
height: 730,
useContentSize: true,
frame: true,
frame: false,
transparent: true,
resizable: true,
resizable: false,
webPreferences: {
nodeIntegration: true,
nodeIntegrationInWorker: true,
nativeWindowOpen: true,
contextIsolation: false,
navigateOnDragDrop: false,
nodeIntegrationInWorker: true,
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.
mainWindow.loadFile(path.join(__dirname, "../renderer/index.html"));

View File

@ -1,63 +1,43 @@
const { videoModeBufferView } = require("./video");
const BITS = 4;
const SCREEN_BUFFER_SIZE = 800 * 600 * BITS; // 32bpp;
const { audioContext } = require("./audio");
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 screenBufferView = new Uint8Array(screenBuffer);
let screenWidth = 800;
let screenHeight = 600;
canvas.width = screenWidth;
canvas.height = screenHeight;
canvas.width = SCREEN_WIDTH;
canvas.height = SCREEN_HEIGHT;
const canvasCtx = canvas.getContext("2d");
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);
});
const imageData = canvasCtx.createImageData(SCREEN_WIDTH, SCREEN_HEIGHT);
let stopDrawing = false;
function drawScreen() {
if (stopDrawing) return;
const pixelsRGBA = imageData.data;
const numPixels = screenWidth * screenHeight;
const numPixels = SCREEN_WIDTH * SCREEN_HEIGHT;
const expandedFromPalettedMode = videoModeBufferView[3];
const start = audioContext.currentTime;
if (expandedFromPalettedMode) {
for (let i = 0; i < numPixels; i++) {
for (var i = 0; i < numPixels; i++) {
// palette
pixelsRGBA[i * BITS + 0] = screenBufferView[i * BITS + 0];
pixelsRGBA[i * BITS + 1] = screenBufferView[i * BITS + 1];
pixelsRGBA[i * BITS + 2] = screenBufferView[i * BITS + 2];
pixelsRGBA[i * BITS + 3] = 255; // full opacity
pixelsRGBA[i * 4 + 0] = screenBufferView[i * 4 + 0];
pixelsRGBA[i * 4 + 1] = screenBufferView[i * 4 + 1];
pixelsRGBA[i * 4 + 2] = screenBufferView[i * 4 + 2];
pixelsRGBA[i * 4 + 3] = 255; // full opacity
}
} else {
for (let i = 0; i < screenHeight; i++) {
for (let j = 0; j < screenWidth; j++) {
// ARGB
const xRatio = 800 / screenWidth;
const yRatio = 600 / screenHeight;
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
}
for (var i = 0; i < numPixels; i++) {
// ARGB
pixelsRGBA[i * 4 + 0] = screenBufferView[i * 4 + 1];
pixelsRGBA[i * 4 + 1] = screenBufferView[i * 4 + 2];
pixelsRGBA[i * 4 + 2] = screenBufferView[i * 4 + 3];
pixelsRGBA[i * 4 + 3] = 255; // full opacity
}
}
@ -89,7 +69,7 @@ module.exports = {
screenBufferView,
SCREEN_BUFFER_SIZE,
drawScreen,
SCREEN_WIDTH: screenWidth,
SCREEN_HEIGHT: screenHeight,
SCREEN_WIDTH,
SCREEN_HEIGHT,
setCanvasBlank,
};

View File

@ -1,38 +0,0 @@
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()

2608
yarn.lock

File diff suppressed because it is too large Load Diff