Skip to content

Commit

Permalink
publish: 6.22.38
Browse files Browse the repository at this point in the history
  • Loading branch information
caiiiycuk committed Oct 30, 2019
1 parent 3140a1c commit aedf8fb
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 89 deletions.
14 changes: 11 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,22 @@ script:
- cd travis-build
- git clone https://github.com/emscripten-core/emsdk.git
- cd emsdk
- ./emsdk install latest-upstream
- ./emsdk activate latest-upstream
- ./emsdk install latest
- ./emsdk install latest-fastcomp
- ./emsdk activate latest
- source ./emsdk_env.sh
- cd ..
- emcmake cmake ..
- make
- make wdosbox wdosbox-nosync
- mkdir ../build
- cp wdosbox.* ../build
- rm -rf ./*
- ./emsdk/emsdk activate latest-fastcomp
- emcc --clear-ports
- emcmake cmake ..
- make wdosbox-emterp
- mkdir ../build-emterp
- cp wdosbox* ../build-enterp
- source /etc/environment
- nvm use 11.8
- npm install -g gulp
Expand Down
46 changes: 25 additions & 21 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
cmake_minimum_required(VERSION 3.6)

set(ASYNCIFY ON)
set(EMTERPRETIFY OFF)

if(${EMSCRIPTEN})
set(OPT_FLAG "-Oz")
set(USE_PORTS "-s USE_ZLIB=1")
Expand All @@ -24,17 +21,10 @@ if(${EMSCRIPTEN})
-s EXPORT_NAME='WDOSBOX' \
-s FORCE_FILESYSTEM=1 \
-s EXTRA_EXPORTED_RUNTIME_METHODS=\"['getMemory', 'addRunDependency', 'removeRunDependency','FS', 'FS_createPath', 'FS_createPreloadedFile', \
'FS_createDataFile', 'lengthBytesUTF8', 'stringToUTF8', 'UTF16ToString']\" \
'FS_createDataFile', 'lengthBytesUTF8', 'stringToUTF8', 'UTF16ToString', 'callMain']\" \
-s NO_EXIT_RUNTIME=1 \
-s ERROR_ON_UNDEFINED_SYMBOLS=0")
add_definitions(-DEMSCRIPTEN)

if(ASYNCIFY)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s ASYNCIFY -s ASYNCIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/asyncify.txt")
# -s ASYNCIFY_IGNORE_INDIRECT \
elseif(EMTERPRETIFY)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/emterpretify.txt")
endif()
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=return-type -Wno-deprecated")
add_definitions(-DDEBUG -DEMSCRIPTEN_KEEPALIVE=)
Expand All @@ -44,13 +34,6 @@ endif()

add_definitions(-DHAVE_CONFIG_H -DGET_X86_FUNCTIONS -DJSDOS)

if(ASYNCIFY)
add_definitions(-DEMTERPRETER_SYNC -DASYNCIFY -Demscripten_sleep_with_yield=emscripten_sleep)
elseif(EMTERPRETIFY)
add_definitions(-DEMTERPRETER_SYNC)
endif()


include(
"${CMAKE_CURRENT_LIST_DIR}/3rd-party/3rd-party.cmake"
)
Expand Down Expand Up @@ -194,10 +177,31 @@ set(SOURCES
)

if(${EMSCRIPTEN})
add_library(bin-obj OBJECT ${SOURCES} ${SOURCES_CXX11} ${SOURCES_3RDPARTY})
add_executable(wdosbox $<TARGET_OBJECTS:bin-obj>)
add_library(bin-asyncify OBJECT ${SOURCES} ${SOURCES_CXX11} ${SOURCES_3RDPARTY})
target_compile_definitions(bin-asyncify PUBLIC -DEMTERPRETER_SYNC -DASYNCIFY -Demscripten_sleep_with_yield=emscripten_sleep)
add_executable(wdosbox $<TARGET_OBJECTS:bin-asyncify>)
set_target_properties(wdosbox PROPERTIES SUFFIX .js)
set_target_properties(wdosbox PROPERTIES LINK_FLAGS "-s WASM=1")
set_target_properties(wdosbox PROPERTIES LINK_FLAGS "-s WASM=1 -s ASYNCIFY -s ASYNCIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/asyncify.txt")
add_executable(dosbox $<TARGET_OBJECTS:bin-asyncify>)
set_target_properties(dosbox PROPERTIES SUFFIX .js)
set_target_properties(dosbox PROPERTIES LINK_FLAGS "-s WASM=0 -s ASYNCIFY -s ASYNCIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/asyncify.txt")

add_library(bin-emterp OBJECT ${SOURCES} ${SOURCES_CXX11} ${SOURCES_3RDPARTY})
target_compile_definitions(bin-emterp PUBLIC -DEMTERPRETER_SYNC)
add_executable(wdosbox-emterp $<TARGET_OBJECTS:bin-emterp>)
set_target_properties(wdosbox-emterp PROPERTIES SUFFIX .js)
set_target_properties(wdosbox-emterp PROPERTIES LINK_FLAGS "-s WASM=1 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/emterpretify.txt")
add_executable(dosbox-emterp $<TARGET_OBJECTS:bin-emterp>)
set_target_properties(dosbox-emterp PROPERTIES SUFFIX .js)
set_target_properties(dosbox-emterp PROPERTIES LINK_FLAGS "-s WASM=0 -s EMTERPRETIFY=1 -s EMTERPRETIFY_ASYNC=1 -s EMTERPRETIFY_WHITELIST=@${CMAKE_CURRENT_LIST_DIR}/js-dos-cpp/emterpretify.txt")

add_library(bin-nosync OBJECT ${SOURCES} ${SOURCES_CXX11} ${SOURCES_3RDPARTY})
add_executable(wdosbox-nosync $<TARGET_OBJECTS:bin-nosync>)
set_target_properties(wdosbox-nosync PROPERTIES SUFFIX .js)
set_target_properties(wdosbox-nosync PROPERTIES LINK_FLAGS "-s WASM=1")
add_executable(dosbox-nosync $<TARGET_OBJECTS:bin-nosync>)
set_target_properties(dosbox-nosync PROPERTIES SUFFIX .js)
set_target_properties(dosbox-nosync PROPERTIES LINK_FLAGS "-s WASM=0")
else()
add_executable(bin ${SOURCES} ${SOURCES_CXX11} ${SOURCES_3RDPARTY})
target_link_libraries(bin
Expand Down
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ You can obtain latest build using this links:
- js-dos client api: https://js-dos.com/6.22/current/js-dos.js
- dosbox wasm wrapper: https://js-dos.com/6.22/current/wdosbox.js
- dosbox wasm file: https://js-dos.com/6.22/current/wdosbox.wasm.js
- dosbox wasm-emterp file: https://js-dos.com/6.22/current/wdosbox-emterp.wasm.js
- dosbox wasm-nosync file: https://js-dos.com/6.22/current/wdosbox-nosync.wasm.js

**NOTE**: do not try to use this links to serve your copy of dosbox. Because this links always pointing to latest
version, and newest version can have breaking changes. Is better to use npx bootstrap command (above), or download latest
Expand Down Expand Up @@ -159,6 +161,18 @@ You can do this by passing `wdosboxUrl` property as second argument:
Dos(canvas, { wdosboxUrl: "/wdosbox.js" }).ready(...);
```

### Changing dosbox variant

By changing wdosboxUrl (see above) you can select different dosbox variants:

* `wdosbox.js` - default variant. This version compiled with latest emscripten and in theory should work best.
* `wdosbox-emterp.js` - This version compiled with legacy fastcomp backend, can be useful in rare cases (e.g. if you have problem with default version).
* `wdosbox-nosync.js` - Fastest possible version, but limited. You can't run console programs/shell emulation using it.

```javascript
Dos(canvas, { wdosboxUrl: "/wdosbox-nosync.js" }).ready(...);
```

### How to handle errors

You can handle errors by defining `onerror` property, or by using `catch` of promise.
Expand Down Expand Up @@ -269,7 +283,9 @@ By default dosbox mouse will follow browser cursor without locking. It means tha
Dos(canvas, { autolock: true }).ready((fs, main) => {
main([...]);
});
// OR
```
** OR **
```javascript
Dos(canvas).ready((fs, main) => {
fs.createFile("dosbox.conf", `
[sdl]
Expand Down Expand Up @@ -454,3 +470,10 @@ Output will be placed in dist folder. Also in dist folder you can find test page
```
firefox dist/test/test.html
```

Additionaly you can run same tests on other variants of js-dos (emterp, nosync). BUT, not all tests will pass.

```
firefox dist/test/test-emterp.html
firefox dist/test/test-nosync.html
```
8 changes: 4 additions & 4 deletions dist/docs/api/js-dos-ts/js-dos-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ gulpfile.js --> generateBuildInfo
```
export const Build = {
version: "6.22.37 (2b23342d2ba488bb3653b8506b7e2667)",
jsVersion: "353e9136ae42c6641ab325375f89ac2f17245287",
version: "6.22.38 (4e5c30d285294adc0f9332460249b7d3)",
jsVersion: "3140a1c193a98193602c66e8094056dc3bb16b8f",
jsSize: 199660,
wasmVersion: "eb83536935802be3c617c911dfce7e28",
wasmSize: 1809140,
wasmVersion: "ab1e5dfd0a5aa35a0ba806d5e2c8b3eb",
wasmSize: 1809135,
};
Expand Down
5 changes: 3 additions & 2 deletions dist/docs/api/js-dos-ts/js-dos-host.md
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ If dosbox is not yet resolved, then:
responseType: "arraybuffer",
progress: (total, loaded) => {
if (module.onprogress) {
module.onprogress("Resolving DosBox", buildTotal, loaded);
module.onprogress("Resolving DosBox", buildTotal, Math.min(Build.wasmSize, loaded));
}
},
fail: (url: string, status: number, message: string) => {
Expand Down Expand Up @@ -301,7 +301,8 @@ If dosbox is not yet resolved, then:
cache,
progress: (total, loaded) => {
if (module.onprogress) {
module.onprogress("Resolving DosBox", buildTotal, Build.wasmSize + loaded);
module.onprogress("Resolving DosBox", buildTotal,
Math.min(buildTotal, Build.wasmSize + loaded));
}
},
fail: (url: string, status: number, message: string) => {
Expand Down
49 changes: 38 additions & 11 deletions dist/docs/api/js-dos-ts/js-dos-options.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ class, to configure emulation layer
```
export class DosBoxConfig {
```







### cycles




```
public cycles?: number | string;
```
Expand All @@ -23,21 +38,27 @@ export class DosBoxConfig {



cycles: Amount of instructions DOSBox tries to emulate each millisecond.
Setting this value too high results in sound dropouts and lags.
Amount of instructions DOSBox tries to emulate each millisecond.
Setting this value too high results in sound dropouts and lags.

Cycles can be set in 3 ways:

* `auto` - tries to guess what a game needs. It usually works, but can fail for certain games.
* `fixed #number` - will set a fixed amount of cycles. This is what you
usually need if 'auto' fails. (Example: fixed 4000).
* `max` - will allocate as much cycles as your computer is able to handle.


Cycles can be set in 3 ways:

'auto' tries to guess what a game needs.
It usually works, but can fail for certain games.

'fixed #number' will set a fixed amount of cycles. This is what you usually need if 'auto' fails.
(Example: fixed 4000).

'max' will allocate as much cycles as your computer is able to handle.




### autolock




```
Expand All @@ -51,7 +72,7 @@ export class DosBoxConfig {



autolock: Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock)
Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock)

By default dosbox mouse will follow browser cursor without locking.
It means that js-dos will not take exclusive control over mouse pointer.
Expand Down Expand Up @@ -193,13 +214,19 @@ you can provide log function, to override logging, by default js-dos uses consol



you can set alternative url for downloading js-dos script, default is 'wdosbox.js'
you can set alternative url for downloading js-dos script, default is `wdosbox.js`.
Additionaly you can change which variant of js-dos script to use:

* `wdosbox.js` - default variant. This version compiled with latest emscripten and in theory should work best
* `wdosbox-emterp.js` - This version compiled with legacy fastcomp backend, can be useful in rare cases
(e.g. if you have problems with default version)
* `wdosbox-nosync.js` - Fastest possible version, but limited. You can't run console programs/shell
emulation using it




```
}
export const DosBoxConfigDefaults: DosBoxConfig = {
Expand Down
9 changes: 5 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,17 @@ gulp.task('generateBuildInfo', function() {
})

gulp.task('copyAssets', function () {
return gulp.src(['test/index.html', 'build/wdosbox.js', 'build/wdosbox.js.symbols'])
return gulp.src(['test/index.html', 'build/wdosbox.js', 'build/wdosbox.js.symbols',
'build/wdosbox-nosync.js', 'build/wdosbox-nosync.js.symbols',
'build-emterp/wdosbox-emterp.js', 'build-emterp/wdosbox-emterp.js.symobls'])
.pipe(gulp.dest('dist'));
});

gulp.task('copyWasm', function () {
return gulp.src('build/wdosbox.wasm')
.pipe(rename("wdosbox.wasm.js"))
return gulp.src(['build/wdosbox.wasm', 'build/wdosbox-nosync.wasm', 'build-emterp/wdosbox-emterp.wasm'])
.pipe(rename({extname: ".wasm.js"}))
.pipe(gulp.dest('dist'));
});

gulp.task('copyTypeScript', function() {
return gulp.src('js-dos-ts/*')
.pipe(gulp.dest('dist/typescript'));
Expand Down
8 changes: 4 additions & 4 deletions js-dos-ts/js-dos-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
// gulpfile.js --> generateBuildInfo

export const Build = {
version: "6.22.37 (2b23342d2ba488bb3653b8506b7e2667)",
jsVersion: "353e9136ae42c6641ab325375f89ac2f17245287",
version: "6.22.38 (4e5c30d285294adc0f9332460249b7d3)",
jsVersion: "3140a1c193a98193602c66e8094056dc3bb16b8f",
jsSize: 199660,
wasmVersion: "eb83536935802be3c617c911dfce7e28",
wasmSize: 1809140,
wasmVersion: "ab1e5dfd0a5aa35a0ba806d5e2c8b3eb",
wasmSize: 1809135,
};
5 changes: 3 additions & 2 deletions js-dos-ts/js-dos-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class DosHost {
responseType: "arraybuffer",
progress: (total, loaded) => {
if (module.onprogress) {
module.onprogress("Resolving DosBox", buildTotal, loaded);
module.onprogress("Resolving DosBox", buildTotal, Math.min(Build.wasmSize, loaded));
}
},
fail: (url: string, status: number, message: string) => {
Expand Down Expand Up @@ -166,7 +166,8 @@ class DosHost {
cache,
progress: (total, loaded) => {
if (module.onprogress) {
module.onprogress("Resolving DosBox", buildTotal, Build.wasmSize + loaded);
module.onprogress("Resolving DosBox", buildTotal,
Math.min(buildTotal, Build.wasmSize + loaded));
}
},
fail: (url: string, status: number, message: string) => {
Expand Down
32 changes: 19 additions & 13 deletions js-dos-ts/js-dos-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
// class, to configure emulation layer

export class DosBoxConfig {
// ### cycles
public cycles?: number | string;
// cycles: Amount of instructions DOSBox tries to emulate each millisecond.
// Setting this value too high results in sound dropouts and lags.
// Amount of instructions DOSBox tries to emulate each millisecond.
// Setting this value too high results in sound dropouts and lags.
//
// Cycles can be set in 3 ways:
// Cycles can be set in 3 ways:
//
// 'auto' tries to guess what a game needs.
// It usually works, but can fail for certain games.
//
// 'fixed #number' will set a fixed amount of cycles. This is what you usually need if 'auto' fails.
// (Example: fixed 4000).
//
// 'max' will allocate as much cycles as your computer is able to handle.
// * `auto` - tries to guess what a game needs. It usually works, but can fail for certain games.
// * `fixed #number` - will set a fixed amount of cycles. This is what you
// usually need if 'auto' fails. (Example: fixed 4000).
// * `max` - will allocate as much cycles as your computer is able to handle.
//

// ### autolock
public autolock?: boolean;
// autolock: Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock)
// Mouse will automatically lock, if you click on the screen. (Press CTRL-F10 to unlock)
//
// By default dosbox mouse will follow browser cursor without locking.
// It means that js-dos will not take exclusive control over mouse pointer.
Expand Down Expand Up @@ -56,8 +56,14 @@ export class DosOptions extends DosBoxConfig {

// ### wdosboxUrl
public wdosboxUrl?: string;
// you can set alternative url for downloading js-dos script, default is 'wdosbox.js'

// you can set alternative url for downloading js-dos script, default is `wdosbox.js`.
// Additionaly you can change which variant of js-dos script to use:
//
// * `wdosbox.js` - default variant. This version compiled with latest emscripten and in theory should work best
// * `wdosbox-emterp.js` - This version compiled with legacy fastcomp backend, can be useful in rare cases
// (e.g. if you have problems with default version)
// * `wdosbox-nosync.js` - Fastest possible version, but limited. You can't run console programs/shell
// emulation using it
}

export const DosBoxConfigDefaults: DosBoxConfig = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "js-dos",
"version": "6.22.37",
"version": "6.22.38",
"description": "Easiest API to run dos programs in browser",
"main": "dist/js-dos.js",
"types": "dist/typescript/js-dos.ts",
Expand Down
1 change: 1 addition & 0 deletions test/test-emterp.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<script src="https://unpkg.com/chai/chai.js"></script>
<script src="https://unpkg.com/mocha@5.2.0/mocha.js"></script>
<script>
window.wdosboxUrl = '/wdosbox-emterp.js';
mocha.setup({
ui: 'qunit',
timeout: 60000
Expand Down
Loading

0 comments on commit aedf8fb

Please sign in to comment.