From 23518a31d24e62caeecbfafe7708f4c7ffcd24f5 Mon Sep 17 00:00:00 2001 From: Alex Xu Date: Wed, 24 Jul 2013 18:40:52 -0400 Subject: fix misc. bugs, add reencode.sh --- README | 1 + reencode.sh | 22 ++++++++++++++++++++++ unrpyc/README | 4 +++- www/index.html | 3 ++- www/js/api.js | 2 +- www/js/html5ks.js | 6 ++++++ www/js/menu.js | 23 +++++++++++++++++------ 7 files changed, 52 insertions(+), 9 deletions(-) create mode 100755 reencode.sh diff --git a/README b/README index 3a70503..170ed2c 100644 --- a/README +++ b/README @@ -9,6 +9,7 @@ How to use: 1. Follow steps in unrpyc/README 2. Extract files from data.rpa with an appropriate tool. Put files in www/dump. 3. Modify www/dump/ui/bt-cf-{un,}checked.png to remove empty borders. +4. Re-encode (sigh) dump/video/* into .mp4, .webm and .ogg files. reencode.sh can be used to do this, but spinning your own is fine too. 4. Run nginx.sh to start nginx with appropriate options for development, then connect to localhost:8080. -- or -- diff --git a/reencode.sh b/reencode.sh new file mode 100755 index 0000000..f7baf0d --- /dev/null +++ b/reencode.sh @@ -0,0 +1,22 @@ +#!/bin/bash +# configure ffmpeg location if not in PATH +FFMPEG=ffmpeg +# configure flags (e.g. if you want to force high -threads) +FFMPEG_FLAGS="" + +set -e +FFMPEG_FLAGS+="$@" +cd $(dirname $0)/www/dump/video + +encode() { + set -x + ${FFMPEG} -i "$1" -c:v "$2" $3 ${FFMPEG_FLAGS} "$4" +} + +for f in *.mkv; do + OUT=${f%.mkv} + encode $f libx264 "-preset slower -tune animation" ${OUT}.mp4 + encode $f libvpx "-crf 15 -b:v 1M -an -f webm -y" /dev/null + encode $f libvpx "-crf 15 -b:v 1M -c:a libvorbis" ${OUT}.webm + encode $f libtheora "-qscale:v 6 -c:a libvorbis" ${OUT}.ogg +done diff --git a/unrpyc/README b/unrpyc/README index 8d68bac..ba1791f 100644 --- a/unrpyc/README +++ b/unrpyc/README @@ -10,6 +10,8 @@ How to use: 4. Run "make" with appropriate -j options (yay auto-parallelization) 5. Run "make install". -If you want to hack on the code, have fun. This is all the documentation you get. +If you're on Windows, sucks for you. Use a better OS. + +If you want to hack on the code, have fun. The code sucks, and this is all the documentation you get. https://github.com/yuriks/unrpyc diff --git a/www/index.html b/www/index.html index 78d9342..9550a64 100644 --- a/www/index.html +++ b/www/index.html @@ -75,7 +75,8 @@ - + + diff --git a/www/js/api.js b/www/js/api.js index edc37b6..21494a2 100644 --- a/www/js/api.js +++ b/www/js/api.js @@ -36,7 +36,7 @@ window.html5ks.api = { html5ks.elements.audio[channel] = audio; audio.src = "dump/" + (channel === "music" ? "bgm/" + html5ks.data.music[name] + ".ogg" : html5ks.data.sfx[name]); audio.load(); - audio.volume = fade ? 0 : 1; + audio.volume = fade ? 0 : html5ks.persistent.settings.musicVolume; audio.play(); audio.onplaying = function () { deferred.resolve(); diff --git a/www/js/html5ks.js b/www/js/html5ks.js index fc3f99a..059cbbe 100644 --- a/www/js/html5ks.js +++ b/www/js/html5ks.js @@ -114,6 +114,12 @@ window.html5ks = { window.addEventListener("dragstart", function (e) { e.preventDefault(); }, false); + if (html5ks.persistent.settings.fullscreen) { + window.addEventListener("click", function click() { + window.removeEventListener("click", click, false); + html5ks.fullscreen(); + }, false); + } }, warnUnsupported: function () { if (!html5ks.persistent.settings.gotit) { diff --git a/www/js/menu.js b/www/js/menu.js index 43d98c4..cb29675 100644 --- a/www/js/menu.js +++ b/www/js/menu.js @@ -39,20 +39,31 @@ var options = document.getElementsByClassName("option"), values = html5ks.persistent.settings; + options[0].parentNode.parentNode.addEventListener("change", function (e) { + var target = e.target; + values[target.id] = typeof target.checked !== "undefined" ? target.checked : target.value; + switch (target.id) { + case "fullscreen": + html5ks.fullscreen(); + break; + case "scaleAll": + case "scaleVideo": + html5ks.scale(); + break; + case "musicVolume": + case "sfxVolume": + html5ks.elements.audio[target.id.replace("Volume", "")].volume = target.value; + break; + } + }, false); for (var i = options.length - 1; i >= 0; i--) { var option = options[i]; switch (option.type) { case "checkbox": option.checked = values[option.id]; - option.addEventListener("change", function () { - values[this.id] = this.checked; - }, false); break; case "range": option.value = values[option.id]; - option.addEventListener("change", function () { - values[this.id] = this.value; - }, false); break; default: console.error("unknown option type %s", option.type); -- cgit v1.2.3-70-g09d2