em-dosbox 10/18 (水) emscripten & WebAssembly night !! #5
em-dosbox10/18 (水)
emscripten & WebAssembly night !! #5
自己紹介• HN: さい
• Twitter: @sairoutine
• Web のフロント/サーバーサイド
• FaithJS っていうブラウザ向けファミコンエミュレータ作ってました
• 現在は Emscripten で PC-98 向けゲームのブラウザ移植やってますが、うまくいってません。誰か助けて...
DOSBox
DOSBox
• https://www.dosbox.com/
• MS-DOSのエミュレータ
• CPUのエミュレートからやってくれる
• DOS向けの古いゲームを動かせる
• Win3.1 などのソフトも動かせる
em-dosbox
• https://github.com/dreamlayers/em-dosbox
• DOSBox をブラウザに移植したもの
• Emscripten を使って、DOSBox のコードをJavaScript (asm.js) に変換
• 任意のDOS向けソフトをブラウザで動かせる
• WebAssembly 形式でも出力可
http://jp.techcrunch.com/2015/01/10/20150109internet-archive-brings-oregon-trail-prince-of-persia-lemmings-and-2200-other-ms-dos-games-to-your-browser/
⇛ em-dosbox を利用してWeb 移植してる
em-dosbox を使って実際にブラウザで動かしてみる
emsdk のセットアップ
git clone [email protected]:juj/emsdk.git
cd emsdk-portable
./emsdk install latest
./emsdk activate latest
source ./emsdk_env.sh
em-dosbox のコンパイル
# em-dosbox のダウンロード
cd ../
git clone [email protected]:dreamlayers/em-dosbox.git
cd em-dosbox
# configure ファイルの生成
./autogen.sh
# emscripten 用Makefile の生成
emconfigure ./configure --without-sdl2
# コンパイル
make
DOS向けアプリをパッケージング
# DOS 用実行ファイルを emscripten 向けにパッケージング
./packager.py DataName AppDir BOOT_APP.EXE
# http-server を起動
python -m SimpleHTTPServer 8000
# ブラウザでアクセス
open http://localhost:8000/badapple.html
DEMO
まとめ
• Emscripten を使うと、既存のC/C++ アプリケーションをブラウザに移植できる
• エミュレータをブラウザに移植すると、古いOS/CPUアーキテクチャ向けのアプリケーションもブラウザに移植できる
• ブラウザで出来ることを増やせる Emscripten は偉大
技術同人誌出します・タイトルEmscriptoon
・説明Emscripten を浅く広く扱った本
・お値段1冊 500円
・頒布10/22 (日) アキバ・スクエアで開催される技術書典 3 「い08」にて頒布予定