js-dos 7.4.9 → 8.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build.yml +51 -0
- package/.gitmodules +4 -0
- package/README.deployment.md +11 -0
- package/README.md +29 -89
- package/index.html +106 -0
- package/package.json +46 -71
- package/postcss.config.cjs +8 -0
- package/src/app.css +14 -0
- package/src/base.css +10 -0
- package/src/components/checkbox.tsx +41 -0
- package/src/components/close-button.tsx +17 -0
- package/src/components/components.css +28 -0
- package/src/components/dos-option-checkbox.tsx +94 -0
- package/src/components/dos-option-select.tsx +108 -0
- package/src/components/dos-option-slider.tsx +35 -0
- package/src/components/error.tsx +16 -0
- package/src/components/loading.tsx +26 -0
- package/src/components/lock.tsx +10 -0
- package/src/components/select.tsx +33 -0
- package/src/components/slider.tsx +69 -0
- package/src/download-file.ts +18 -0
- package/src/frame/account-frame.tsx +156 -0
- package/src/frame/editor/defaults.ts +419 -0
- package/src/frame/editor/editor-conf-frame.tsx +226 -0
- package/src/frame/editor/editor-frame.css +55 -0
- package/src/frame/editor/editor-fs-frame.tsx +314 -0
- package/src/frame/fat-drives-frame.tsx +135 -0
- package/src/frame/frame.css +119 -0
- package/src/frame/frame.tsx +34 -0
- package/src/frame/image-rendering-frame.tsx +8 -0
- package/src/frame/network-frame.tsx +157 -0
- package/src/frame/quick-save-frame.tsx +96 -0
- package/src/frame/settings-frame.tsx +14 -0
- package/src/frame/stats-frame.tsx +87 -0
- package/src/host/bundle-storage.ts +91 -0
- package/src/host/fullscreen.ts +35 -0
- package/src/host/lcache.ts +203 -0
- package/src/host/lstorage.ts +156 -0
- package/src/i18n.ts +179 -0
- package/src/index.css +7 -0
- package/src/load.ts +132 -0
- package/src/login/login.css +9 -0
- package/src/login/login.tsx +77 -0
- package/src/main.tsx +197 -0
- package/src/public/types.ts +41 -0
- package/src/sidebar/account-button.tsx +33 -0
- package/src/sidebar/cloud-save-button.tsx +89 -0
- package/src/sidebar/diskette-icon.tsx +14 -0
- package/src/sidebar/fullscreen-button.tsx +44 -0
- package/src/sidebar/network-button.tsx +39 -0
- package/src/sidebar/sidebar-button.tsx +244 -0
- package/src/sidebar/sidebar.css +47 -0
- package/src/sidebar/sidebar.tsx +30 -0
- package/src/sockdrive/LICENSE +674 -0
- package/src/sockdrive/README.md +45 -0
- package/src/sockdrive/include/sockdrive.h +23 -0
- package/src/sockdrive/js/.eslintrc.json +43 -0
- package/src/sockdrive/js/package.json +29 -0
- package/src/sockdrive/js/src/fatfs/chains.js +318 -0
- package/src/sockdrive/js/src/fatfs/dir.js +385 -0
- package/src/sockdrive/js/src/fatfs/helpers.js +210 -0
- package/src/sockdrive/js/src/fatfs/index.js +606 -0
- package/src/sockdrive/js/src/fatfs/structs.js +255 -0
- package/src/sockdrive/js/src/fatfs/vol.js +166 -0
- package/src/sockdrive/js/src/sockdrive/cache.ts +133 -0
- package/src/sockdrive/js/src/sockdrive/drive.ts +457 -0
- package/src/sockdrive/js/src/sockdrive/lru.ts +221 -0
- package/src/sockdrive/js/src/sockdrive/types.ts +14 -0
- package/src/sockdrive/js/src/sockdrive-fat.d.ts +64 -0
- package/src/sockdrive/js/src/sockdrive-fat.ts +226 -0
- package/src/sockdrive/js/src/sockdrive-native.ts +100 -0
- package/src/sockdrive/js/src/test/test.ts +288 -0
- package/src/sockdrive/js/tsconfig.json +11 -0
- package/src/sockdrive/js/webpack.config.js +68 -0
- package/src/sockdrive/js/yarn.lock +1808 -0
- package/src/store/auth.ts +115 -0
- package/src/store/dos.ts +305 -0
- package/src/store/editor.ts +61 -0
- package/src/store/init.ts +48 -0
- package/src/store/storage.ts +32 -0
- package/src/store/ui.ts +186 -0
- package/src/store.tsx +108 -0
- package/src/ui.tsx +104 -0
- package/src/v8/changes.ts +56 -0
- package/src/v8/config.ts +18 -0
- package/src/v8/subscriptions.ts +62 -0
- package/src/vite-env.d.ts +2 -0
- package/src/window/dos/controls/keyboard.ts +32 -0
- package/src/window/dos/controls/keys.ts +331 -0
- package/src/window/dos/controls/mouse/mount.ts +99 -0
- package/src/window/dos/controls/mouse/mouse-locked.ts +51 -0
- package/src/window/dos/controls/mouse/mouse-not-locked.ts +84 -0
- package/src/window/dos/controls/mouse/mouse-swipe.ts +57 -0
- package/src/window/dos/controls/mouse/pointer.ts +85 -0
- package/src/window/dos/controls/mouse.ts +21 -0
- package/src/window/dos/dos-dhry2.tsx +191 -0
- package/src/window/dos/dos-runtime.tsx +214 -0
- package/src/window/dos/dos-window.tsx +84 -0
- package/src/window/dos/render/canvas.ts +65 -0
- package/src/window/dos/render/resize.ts +31 -0
- package/src/window/dos/render/webgl.ts +173 -0
- package/src/window/dos/sound/audio-node.ts +148 -0
- package/src/window/error-window.tsx +9 -0
- package/src/window/loading-window.tsx +54 -0
- package/src/window/prerun-window.tsx +123 -0
- package/src/window/select-window.tsx +118 -0
- package/src/window/window.css +78 -0
- package/src/window/window.tsx +49 -0
- package/src/ws/ws-sockdrive.ts +101 -0
- package/src/ws/ws-transport-layer.ts +455 -0
- package/tailwind.config.cjs +48 -0
- package/tsconfig.json +32 -0
- package/tsconfig.node.json +9 -0
- package/vite.config.ts +22 -0
- package/LICENSE +0 -339
- package/dist/emulators-ui-loader.png +0 -0
- package/dist/js-dos.css +0 -1690
- package/dist/js-dos.js +0 -17
- package/dist/js-dos.js.map +0 -1
- package/dist/types/src/backend/v7/latency.d.ts +0 -8
- package/dist/types/src/backend/v7/personal.d.ts +0 -2
- package/dist/types/src/backend/v7/v7-config.d.ts +0 -16
- package/dist/types/src/components/action-bar.d.ts +0 -2
- package/dist/types/src/components/action-hide.d.ts +0 -4
- package/dist/types/src/components/action-save-or-exit.d.ts +0 -4
- package/dist/types/src/components/client.d.ts +0 -6
- package/dist/types/src/components/controls.d.ts +0 -8
- package/dist/types/src/components/cpu-control.d.ts +0 -2
- package/dist/types/src/components/horizontal-slider.d.ts +0 -13
- package/dist/types/src/components/region.d.ts +0 -6
- package/dist/types/src/components/scale-control.d.ts +0 -3
- package/dist/types/src/components/sensitivity-control.d.ts +0 -3
- package/dist/types/src/components/sidebar/latency-info.d.ts +0 -7
- package/dist/types/src/components/sidebar/main.d.ts +0 -2
- package/dist/types/src/components/sidebar/networking.d.ts +0 -2
- package/dist/types/src/components/sidebar/token/token-add-time.d.ts +0 -2
- package/dist/types/src/components/sidebar/token/token-select.d.ts +0 -2
- package/dist/types/src/components/sidebar/token/token.d.ts +0 -17
- package/dist/types/src/components/sidebar.d.ts +0 -2
- package/dist/types/src/components/sync-control.d.ts +0 -2
- package/dist/types/src/components/tip.d.ts +0 -2
- package/dist/types/src/components/vertical-slider.d.ts +0 -12
- package/dist/types/src/components/volume-control.d.ts +0 -3
- package/dist/types/src/dom.d.ts +0 -8
- package/dist/types/src/hardware-transport-layer.d.ts +0 -18
- package/dist/types/src/icons.d.ts +0 -95
- package/dist/types/src/player-app.d.ts +0 -50
- package/dist/types/src/player.d.ts +0 -29
- package/dist/types/src/request.d.ts +0 -1
- package/dist/types/src/xhr.d.ts +0 -6
- package/dist/types/v7-services/src/personal.d.ts +0 -3
- package/dist/wdosbox.js +0 -55
- package/dist/wdosbox.js.symbols +0 -3174
- package/dist/wdosbox.wasm +0 -0
- package/examples/digger/index.html +0 -71
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ 8.xx ]
|
|
6
|
+
tags:
|
|
7
|
+
- "v*.*.*"
|
|
8
|
+
pull_request:
|
|
9
|
+
branches: [ 8.xx ]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
strategy:
|
|
16
|
+
matrix:
|
|
17
|
+
node-version: [18.x]
|
|
18
|
+
|
|
19
|
+
steps:
|
|
20
|
+
- uses: actions/checkout@v4
|
|
21
|
+
with:
|
|
22
|
+
submodules: 'recursive'
|
|
23
|
+
- name: build js-dos
|
|
24
|
+
uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: ${{ matrix.node-version }}
|
|
27
|
+
registry-url: 'https://registry.npmjs.org'
|
|
28
|
+
cache: 'npm'
|
|
29
|
+
- run: npm install -g yarn
|
|
30
|
+
- run: yarn
|
|
31
|
+
- run: yarn run eslint . --ext ts,tsx --max-warnings 0
|
|
32
|
+
- run: mkdir -p public/emulators && cp -rv node_modules/emulators/dist/* public/emulators
|
|
33
|
+
- run: NODE_ENV=production yarn run vite build --base /latest --sourcemap true --minify terser
|
|
34
|
+
- run: zip -9r release.zip dist/*
|
|
35
|
+
- name: publish
|
|
36
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
37
|
+
run: npm publish
|
|
38
|
+
env:
|
|
39
|
+
NODE_AUTH_TOKEN: ${{secrets.NODE_AUTH_TOKEN}}
|
|
40
|
+
- name: upload
|
|
41
|
+
uses: actions/upload-artifact@v3.0.0
|
|
42
|
+
with:
|
|
43
|
+
name: 'dist'
|
|
44
|
+
path: 'dist'
|
|
45
|
+
- name: Release
|
|
46
|
+
uses: softprops/action-gh-release@v2
|
|
47
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
48
|
+
with:
|
|
49
|
+
name: ${{ github.ref_name }}
|
|
50
|
+
files: |
|
|
51
|
+
${{github.workspace}}/release.zip
|
package/.gitmodules
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Deployment
|
|
2
|
+
|
|
3
|
+
Build and push release version:
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
yarn run vite build --base /latest --sourcemap true --minify terser && \
|
|
7
|
+
aws s3 --endpoint-url=https://storage.yandexcloud.net sync --acl public-read \
|
|
8
|
+
dist s3://jsdos/latest --delete
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Clear the CDN cache in dashboard.
|
package/README.md
CHANGED
|
@@ -1,107 +1,47 @@
|
|
|
1
|
-
# js-dos
|
|
2
|
-
[](https://github.com/caiiiycuk/js-dos/actions/workflows/build.yml)
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
The simplest API to run **DOS/Win** 9x programs in browser or node. js-dos provides full-featured DOS player that can be easily installed and used to get your DOS program up
|
|
5
|
+
and running in browser quickly. js-dos provide many advanced features like multiplayer and cloud storage. All available features are enabled for any integration and free.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
npx create-dosbox my-app
|
|
18
|
-
cd my-app
|
|
19
|
-
npm install
|
|
20
|
-
npm start
|
|
21
|
-
---
|
|
22
|
-
Open localhost:8080 in browser
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
You will be prompted to select game that you want bootstrap.
|
|
26
|
-
|
|
27
|
-
If you've previously installed `create-dosbox` globally via `npm install -g create-dosbox`, we recommend you uninstall the package using `npm uninstall -g create-dosbox` or `yarn global remove create-dosbox` to ensure that npx always uses the latest version.
|
|
7
|
+
The key features:
|
|
8
|
+
* Works in **worker** or render thread
|
|
9
|
+
* Support execution in Node and Browsers
|
|
10
|
+
* Multiple backends: DOSBox, DOSBox-X
|
|
11
|
+
* Mobile support (v8 - WIP, v7 - production)
|
|
12
|
+
* Able to run very big games (like Diablo, etc.)
|
|
13
|
+
* Multiplayer support
|
|
14
|
+
* Cloud storage
|
|
15
|
+
* WebAssembly and pure JS versions
|
|
16
|
+
|
|
28
17
|
|
|
29
|
-
_([npx](https://medium.com/@maybekatz/introducing-npx-an-npm-package-runner-55f7d4bd282b) comes with npm 5.2+ and higher, see [instructions for older npm versions](https://gist.github.com/gaearon/4064d3c23a77c74a3614c498a8bb1c5f))_
|
|
30
18
|
|
|
31
|
-
|
|
19
|
+
[](https://youtu.be/lhFrAe5YrJE)
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
<img src='https://github.com/js-dos/create-dosbox/raw/master/npx-create-dosbox.gif' width='600' alt='npm start'>
|
|
35
|
-
</p>
|
|
21
|
+
## Documentation
|
|
36
22
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
├── package.json
|
|
43
|
-
└── _site
|
|
44
|
-
├── js-dos
|
|
45
|
-
├── bundle.jsdos
|
|
46
|
-
└── index.html
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
No configuration or complicated folder structures, only the files you need to build your app.<br>
|
|
23
|
+
* [js-dos 8.xx](https://js-dos.com/overview.html)
|
|
24
|
+
* [js-dos 7.xx](https://js-dos.com/v7/build/)
|
|
25
|
+
* [js-dos 6.22](https://js-dos.com/index_6.22.html)
|
|
26
|
+
* [js-dos 3.xx](https://js-dos.com/index_v3.html)
|
|
27
|
+
* [Repository](https://github.com/caiiiycuk/js-dos-docs)
|
|
50
28
|
|
|
51
|
-
|
|
52
|
-
* **bundle.jsdos** - is a bundle with game to start [read more](https://js-dos.com/v7/build/docs/jsdos-bundle)
|
|
53
|
-
* **index.html** - is a web page template
|
|
29
|
+
Demo:
|
|
54
30
|
|
|
55
|
-
|
|
31
|
+
[DOS.Zone](https://dos.zone)
|
|
56
32
|
|
|
57
|
-
|
|
33
|
+
## Development
|
|
58
34
|
|
|
59
|
-
|
|
60
|
-
cd my-app
|
|
35
|
+
1. You need to install node dependencies and put `emulators@beta` into `public/emulators`.
|
|
61
36
|
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
```sh
|
|
66
|
-
npm install
|
|
67
|
-
npm start
|
|
37
|
+
yarn
|
|
38
|
+
cp -rv node_modules/emulators/dist/* public/emulators
|
|
68
39
|
```
|
|
69
|
-
|
|
70
|
-
Open [http://localhost:8080](http://localhost:8080) to view it in the browser.
|
|
40
|
+
2. Run `yarn run vite` and open [http://localhost:3000](http://localhost:3000) js-dos is ready!
|
|
71
41
|
|
|
72
42
|
## Community
|
|
73
43
|
|
|
74
|
-
|
|
75
|
-
|
|
44
|
+
* [DOS.Zone](https://dos.zone)
|
|
76
45
|
* [Discord](https://discord.com/invite/hMVYEbG)
|
|
77
46
|
* [Twitter](https://twitter.com/intent/user?screen_name=doszone_db)
|
|
78
47
|
* [Telegram](https://t.me/doszone)
|
|
79
|
-
|
|
80
|
-
## Building
|
|
81
|
-
|
|
82
|
-
To build whole project do:
|
|
83
|
-
```
|
|
84
|
-
yarn
|
|
85
|
-
NODE_ENV=production yarn run gulp
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Also, you can build js and css separately:
|
|
89
|
-
|
|
90
|
-
```
|
|
91
|
-
yarn run gulp js
|
|
92
|
-
yarn run gulp css
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Example
|
|
96
|
-
|
|
97
|
-
To run built-in example do:
|
|
98
|
-
|
|
99
|
-
```
|
|
100
|
-
hs .
|
|
101
|
-
firefox examples/digger/index.html
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
# Older releases
|
|
105
|
-
|
|
106
|
-
* [js-dos 6.22](https://js-dos.com/index_6.22.html)
|
|
107
|
-
* [js-dos 3.xx](https://js-dos.com/index_v3.html)
|
package/index.html
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>js-dos 8.xx</title>
|
|
8
|
+
<style>
|
|
9
|
+
html,
|
|
10
|
+
body {
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
}
|
|
14
|
+
</style>
|
|
15
|
+
</head>
|
|
16
|
+
|
|
17
|
+
<body>
|
|
18
|
+
<div id="app"></div>
|
|
19
|
+
<script type="module" src="/src/main.tsx">
|
|
20
|
+
</script>
|
|
21
|
+
<script>
|
|
22
|
+
const params = new URLSearchParams(location.search);
|
|
23
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
24
|
+
/* eslint-disable max-len */
|
|
25
|
+
/* eslint-enable max-len */
|
|
26
|
+
const props = Dos(document.getElementById("app"),
|
|
27
|
+
{
|
|
28
|
+
// url: decodeURIComponent("https%3A%2F%2Fcdn.dos.zone%2Fcustom%2Fdos%2Fdoom_dm.jsdos"),
|
|
29
|
+
// url: decodeURIComponent("https%3A%2F%2Fcdn.dos.zone%2Fcustom%2Fdos%2Fhomm2_netbios.jsdos"),
|
|
30
|
+
// url: "https://cdn.dos.zone/original/2X/2/24b00b14f118580763440ecaddcc948f8cb94f14.jsdos", // digger
|
|
31
|
+
// url: "https://cdn.dos.zone/custom/dos/doom.jsdos",
|
|
32
|
+
// url: "https://cdn.dos.zone/custom/dos/duke3d_ipx.jsdos",
|
|
33
|
+
// url: "https://br.cdn.dos.zone/ipx/duke3d/duke3d_ipx.jsdos",
|
|
34
|
+
// url: "https://br.cdn.dos.zone/ipx/doom_dm/doom_dm.jsdos",
|
|
35
|
+
// url: "https://cdn.dos.zone/original/2X/b/b4b5275904d86a4ab8a20917b2b7e34f0df47bf7.jsdos", // dhry2
|
|
36
|
+
// url: "https://cdn.dos.zone/original/2X/7/744842062905f72648a4d492ccc2526d039b3702.jsdos", // sim-city
|
|
37
|
+
// dosboxConf: diabloConf,
|
|
38
|
+
pathPrefix: "/emulators/",
|
|
39
|
+
server: params.get("server"),
|
|
40
|
+
room: params.get("room"),
|
|
41
|
+
//backendHardware: (backend) => {
|
|
42
|
+
// console.log("Hardware backend for", backend);
|
|
43
|
+
// return Promise.resolve("ws://127.0.0.1:8080");
|
|
44
|
+
//},
|
|
45
|
+
onEvent: (event) => {
|
|
46
|
+
console.log("Event", event)
|
|
47
|
+
if (event === "ci-ready") {
|
|
48
|
+
// props.setFrame("network");
|
|
49
|
+
// props.setFullScreen(true);
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const diabloConf = `
|
|
56
|
+
[sdl]
|
|
57
|
+
autolock=false
|
|
58
|
+
mouse_emulation=integration
|
|
59
|
+
|
|
60
|
+
[dosbox]
|
|
61
|
+
title=Windows 95
|
|
62
|
+
memsize=128
|
|
63
|
+
|
|
64
|
+
[video]
|
|
65
|
+
vmemsize=8
|
|
66
|
+
vesa modelist width limit=0
|
|
67
|
+
vesa modelist height limit=0
|
|
68
|
+
|
|
69
|
+
[dos]
|
|
70
|
+
ver=7.1
|
|
71
|
+
hard drive data rate limit=0
|
|
72
|
+
floppy drive data rate limit=0
|
|
73
|
+
|
|
74
|
+
[cpu]
|
|
75
|
+
cputype=pentium_mmx
|
|
76
|
+
core=auto
|
|
77
|
+
integration device=true
|
|
78
|
+
|
|
79
|
+
[sblaster]
|
|
80
|
+
sbtype=sb16vibra
|
|
81
|
+
|
|
82
|
+
[fdc, primary]
|
|
83
|
+
int13fakev86io=true
|
|
84
|
+
|
|
85
|
+
[ide, primary]
|
|
86
|
+
int13fakeio=true
|
|
87
|
+
int13fakev86io=true
|
|
88
|
+
|
|
89
|
+
[ide, secondary]
|
|
90
|
+
int13fakeio=true
|
|
91
|
+
int13fakev86io=true
|
|
92
|
+
cd-rom insertion delay=4000
|
|
93
|
+
|
|
94
|
+
[render]
|
|
95
|
+
scaler=none
|
|
96
|
+
|
|
97
|
+
[autoexec]
|
|
98
|
+
echo off
|
|
99
|
+
imgmount 2 sockdrive wss://backend.make-vm.com:8001 dos.zone diablo_109_c
|
|
100
|
+
imgmount 3 sockdrive wss://backend.make-vm.com:8001 dos.zone diablo_109_d
|
|
101
|
+
boot c:
|
|
102
|
+
`;
|
|
103
|
+
</script>
|
|
104
|
+
</body>
|
|
105
|
+
|
|
106
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,73 +1,48 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"browserify": "^17.0.0",
|
|
49
|
-
"core-js": "^3.23.5",
|
|
50
|
-
"del": "^6.1.1",
|
|
51
|
-
"emulators": "0.73.8",
|
|
52
|
-
"emulators-ui": "0.73.7",
|
|
53
|
-
"eslint": "^8.20.0",
|
|
54
|
-
"eslint-config-google": "^0.14.0",
|
|
55
|
-
"gulp": "^4.0.2",
|
|
56
|
-
"gulp-concat": "^2.6.1",
|
|
57
|
-
"gulp-rename": "^2.0.0",
|
|
58
|
-
"gulp-size": "^4.0.1",
|
|
59
|
-
"gulp-sourcemaps": "^3.0.0",
|
|
60
|
-
"gulp-terser": "^2.1.0",
|
|
61
|
-
"htm": "^3.1.1",
|
|
62
|
-
"preact": "^10.10.0",
|
|
63
|
-
"tailwindcss": "^2.2.17",
|
|
64
|
-
"ts-node": "^10.9.1",
|
|
65
|
-
"tsify": "^5.0.4",
|
|
66
|
-
"typescript": "^4.7.4",
|
|
67
|
-
"vinyl-buffer": "^1.0.1",
|
|
68
|
-
"vinyl-source-stream": "^2.0.0"
|
|
69
|
-
},
|
|
70
|
-
"dependencies": {
|
|
71
|
-
"nanoid": "^3.3.4"
|
|
72
|
-
}
|
|
2
|
+
"name": "js-dos",
|
|
3
|
+
"version": "8.1.0",
|
|
4
|
+
"description": "Full-featured DOS player with multiple emulator backends",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"js-dos",
|
|
8
|
+
"dos",
|
|
9
|
+
"api",
|
|
10
|
+
"browser",
|
|
11
|
+
"dosbox",
|
|
12
|
+
"emulators",
|
|
13
|
+
"webassembly"
|
|
14
|
+
],
|
|
15
|
+
"author": "Alexander Guryanov (aka caiiiycuk)",
|
|
16
|
+
"license": "GPL-2.0",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/caiiiycuk/js-dos/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://js-dos.com",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"dev": "vite",
|
|
23
|
+
"build": "tsc && vite build",
|
|
24
|
+
"preview": "vite preview"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@reduxjs/toolkit": "^1.9.7",
|
|
28
|
+
"preact": "^10.19.3",
|
|
29
|
+
"react-checkbox-tree": "^1.8.0",
|
|
30
|
+
"react-redux": "^8.1.3"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@preact/preset-vite": "^2.8.1",
|
|
34
|
+
"@typescript-eslint/eslint-plugin": "^6.20.0",
|
|
35
|
+
"@typescript-eslint/parser": "^6.20.0",
|
|
36
|
+
"autoprefixer": "^10.4.17",
|
|
37
|
+
"daisyui": "^3.9.3",
|
|
38
|
+
"emulators": "8.1.2",
|
|
39
|
+
"eslint": "^8.56.0",
|
|
40
|
+
"eslint-config-google": "^0.14.0",
|
|
41
|
+
"postcss": "^8.4.33",
|
|
42
|
+
"postcss-import": "^16.0.0",
|
|
43
|
+
"tailwindcss": "^3.4.1",
|
|
44
|
+
"terser": "^5.27.0",
|
|
45
|
+
"typescript": "^5.3.3",
|
|
46
|
+
"vite": "^5.0.12"
|
|
47
|
+
}
|
|
73
48
|
}
|
package/src/app.css
ADDED
package/src/base.css
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { useEffect, useRef } from "preact/hooks";
|
|
2
|
+
|
|
3
|
+
export function Checkbox(props: {
|
|
4
|
+
class?: string,
|
|
5
|
+
toggleClass?: string,
|
|
6
|
+
label: string,
|
|
7
|
+
checked?: boolean,
|
|
8
|
+
onChange?: (value: boolean) => void,
|
|
9
|
+
disabled?: boolean,
|
|
10
|
+
intermediate?: boolean,
|
|
11
|
+
}) {
|
|
12
|
+
const ref = useRef<HTMLInputElement>(null);
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (ref === null || ref.current === null) {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
(ref.current as any).indeterminate = props.intermediate;
|
|
20
|
+
}, [ref, props.intermediate]);
|
|
21
|
+
|
|
22
|
+
function onChange() {
|
|
23
|
+
if (props.onChange) {
|
|
24
|
+
props.onChange(!(props.checked === true));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return <div className={props.class + " form-control option"}
|
|
29
|
+
onClick={onChange}>
|
|
30
|
+
<label className="label cursor-pointer">
|
|
31
|
+
<span className="label-text mr-6">{props.label}</span>
|
|
32
|
+
<input
|
|
33
|
+
ref={ref}
|
|
34
|
+
checked={props.checked === true}
|
|
35
|
+
type="checkbox"
|
|
36
|
+
className={ "toggle " + (props.checked ? " toggle-primary " : "") +
|
|
37
|
+
props.toggleClass }
|
|
38
|
+
disabled={props.disabled === true} />
|
|
39
|
+
</label>
|
|
40
|
+
</div>;
|
|
41
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function CloseButton(props: {
|
|
2
|
+
onClose: () => void
|
|
3
|
+
class?: string,
|
|
4
|
+
}) {
|
|
5
|
+
return <div class={ "text-gray-400 hover:text-gray-600 btn " +
|
|
6
|
+
props.class } onClick={props.onClose}>
|
|
7
|
+
<svg xmlns="http://www.w3.org/2000/svg"
|
|
8
|
+
class="w-full h-full"
|
|
9
|
+
fill="none"
|
|
10
|
+
viewBox="0 0 24 24"
|
|
11
|
+
stroke="currentColor"
|
|
12
|
+
stroke-width="2">
|
|
13
|
+
<path stroke-linecap="round" stroke-linejoin="round"
|
|
14
|
+
d="M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
15
|
+
</svg>
|
|
16
|
+
</div>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.jsdos-rso {
|
|
2
|
+
select {
|
|
3
|
+
@apply select select-bordered;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.slider {
|
|
7
|
+
@apply flex flex-row items-center;
|
|
8
|
+
|
|
9
|
+
.label {
|
|
10
|
+
@apply mr-4 w-min;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.touch {
|
|
14
|
+
@apply cursor-pointer h-16 relative flex-grow flex flex-row items-center;
|
|
15
|
+
|
|
16
|
+
.bg {
|
|
17
|
+
@apply w-full h-2 rounded-full;
|
|
18
|
+
background-color: hsl(var(--b2));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.point {
|
|
22
|
+
@apply absolute h-6 w-6 rounded-full;
|
|
23
|
+
background-color: hsl(var(--bc));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { useDispatch, useSelector } from "react-redux";
|
|
2
|
+
import { useT } from "../i18n";
|
|
3
|
+
import { State, useNonSerializableStore } from "../store";
|
|
4
|
+
import { dosSlice } from "../store/dos";
|
|
5
|
+
import { dispatchLoginAction, uiSlice } from "../store/ui";
|
|
6
|
+
import { Checkbox } from "./checkbox";
|
|
7
|
+
|
|
8
|
+
export function Editor() {
|
|
9
|
+
const t = useT();
|
|
10
|
+
const dispatch = useDispatch();
|
|
11
|
+
const editor = useSelector((state: State) => state.ui.editor);
|
|
12
|
+
return <Checkbox
|
|
13
|
+
class="mt-4"
|
|
14
|
+
label={t("editor")}
|
|
15
|
+
checked={editor}
|
|
16
|
+
onChange={(e) => dispatch(uiSlice.actions.setEditor(e))}
|
|
17
|
+
/>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function MouseCapture() {
|
|
21
|
+
const t = useT();
|
|
22
|
+
const dispatch = useDispatch();
|
|
23
|
+
const lock = useSelector((state: State) => state.dos.mouseCapture);
|
|
24
|
+
return <Checkbox
|
|
25
|
+
class="mt-4"
|
|
26
|
+
label={t("mouse_lock")}
|
|
27
|
+
checked={lock}
|
|
28
|
+
onChange={(l) => dispatch(dosSlice.actions.mouseCapture(l))}
|
|
29
|
+
/>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function PauseCheckbox() {
|
|
33
|
+
const t = useT();
|
|
34
|
+
const dispatch = useDispatch();
|
|
35
|
+
const paused = useSelector((state: State) => state.dos.paused);
|
|
36
|
+
const disabled = useSelector((state: State) => state.ui.window) !== "run";
|
|
37
|
+
return <Checkbox
|
|
38
|
+
class="mt-4"
|
|
39
|
+
label={t("pause")}
|
|
40
|
+
checked={paused}
|
|
41
|
+
disabled={disabled}
|
|
42
|
+
onChange={(p) => dispatch(dosSlice.actions.paused(p))}
|
|
43
|
+
/>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function WorkerCheckbox() {
|
|
47
|
+
const t = useT();
|
|
48
|
+
const dispatch = useDispatch();
|
|
49
|
+
const worker = useSelector((state: State) => state.dos.worker);
|
|
50
|
+
const hardware = useSelector((state: State) => state.dos.backendHardware);
|
|
51
|
+
const disabled = useSelector((state: State) => state.ui.window) === "run";
|
|
52
|
+
const nonSerializableStore = useNonSerializableStore();
|
|
53
|
+
return hardware && nonSerializableStore.options.backendHardware ? null : <Checkbox
|
|
54
|
+
class="mt-4"
|
|
55
|
+
label={t("worker")}
|
|
56
|
+
checked={worker}
|
|
57
|
+
disabled={disabled}
|
|
58
|
+
onChange={(w) => dispatch(dosSlice.actions.dosWorker(w))}
|
|
59
|
+
/>;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function HardwareCheckbox() {
|
|
63
|
+
const t = useT();
|
|
64
|
+
const dispatch = useDispatch();
|
|
65
|
+
const hardware = useSelector((state: State) => state.dos.backendHardware);
|
|
66
|
+
const nonSerializableStore = useNonSerializableStore();
|
|
67
|
+
return nonSerializableStore.options.backendHardware ? <Checkbox
|
|
68
|
+
class="mt-4"
|
|
69
|
+
label={t("hardware")}
|
|
70
|
+
checked={hardware}
|
|
71
|
+
onChange={(h) => dispatch(dosSlice.actions.dosBackendHardware(h))}
|
|
72
|
+
/> : null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function SockdriveWrite() {
|
|
76
|
+
const t = useT();
|
|
77
|
+
const dispatch = useDispatch();
|
|
78
|
+
const account = useSelector((state: State) => state.auth.account);
|
|
79
|
+
const premium = account?.premium === true;
|
|
80
|
+
const visible = useSelector((state: State) => state.dos.backend === "dosboxX");
|
|
81
|
+
const checked = useSelector((state: State) => state.dos.sockdriveWrite) && premium;
|
|
82
|
+
return visible ? <Checkbox
|
|
83
|
+
class="mt-4"
|
|
84
|
+
label={t("fat_write")}
|
|
85
|
+
checked={checked}
|
|
86
|
+
onChange={(c) => {
|
|
87
|
+
if (!premium) {
|
|
88
|
+
dispatchLoginAction(account, dispatch);
|
|
89
|
+
} else {
|
|
90
|
+
dispatch(dosSlice.actions.setSockdriveWrite(c));
|
|
91
|
+
}
|
|
92
|
+
}}
|
|
93
|
+
/> : null;
|
|
94
|
+
}
|