summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-08-06 13:50:37 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-08-06 13:50:37 -0400
commit3eb16e7cf29dde4a4c50b544f794756b6c0ae439 (patch)
treee2f562b6b6c4fb8054dfb4d55a7e977976fa395e
parent1a9a7655c0bd9fdf8d77d1763aca8b67d2264e08 (diff)
downloadhtml5ks-3eb16e7cf29dde4a4c50b544f794756b6c0ae439.tar.xz
html5ks-3eb16e7cf29dde4a4c50b544f794756b6c0ae439.zip
fix stuff and such, work on unrpyc imachine
-rw-r--r--unrpyc/Makefile11
-rw-r--r--unrpyc/decompiler.py22
-rw-r--r--www/js/html5ks.js19
3 files changed, 27 insertions, 25 deletions
diff --git a/unrpyc/Makefile b/unrpyc/Makefile
index 6e28df4..77a0838 100644
--- a/unrpyc/Makefile
+++ b/unrpyc/Makefile
@@ -1,4 +1,6 @@
-all: script.json.gz
+all: script.json.gz imachine.json.gz
+
+imachine.json.gz: imachine.json
script.json.gz: script.json
gzip -9c script.json > script.json.gz
@@ -8,15 +10,15 @@ script.json: $(patsubst %.rpyc,%.json,$(wildcard *.rpyc))
cat script-*.json > script.json
sed -i -e 's/^/{/;s/,$$/}/' script.json
-script-%.json.o: script-%.rpyc *.py
+%.json.o: %.rpyc *.py
python unrpyc.py --clobber $< $@
-script-%.json: script-%.json.o
+%.json: %.json.o
node fix.js $< $@
sed -i -e 's/^{//;s/}$$/,/' $@
clean:
- rm -f *.json.o *.json script.json.gz
+ rm -f *.json.o *.json *.gz
test: all
jshint --show-non-errors *.json
@@ -25,3 +27,4 @@ install: all
install -t ../www/scripts script.json script.json.gz
.PHONY: all clean test install
+.PRECIOUS: imachine.json.o
diff --git a/unrpyc/decompiler.py b/unrpyc/decompiler.py
index 5a9b3bb..c66e280 100644
--- a/unrpyc/decompiler.py
+++ b/unrpyc/decompiler.py
@@ -63,7 +63,6 @@ def print_atl(f, atl_block, indent_level):
return
if not atl_block.statements:
indent(f, indent_level)
- f.write('pass\n')
for stmt in atl_block.statements:
indent(f, indent_level)
@@ -380,21 +379,19 @@ def print_Menu(f, stmt, indent_level):
f.write('}]\n')
def print_Pass(f, stmt, indent_level):
- f.write("pass\n")
+ f.write("\n")
def print_Call(f, stmt, indent_level):
- f.write("call ")
+ f.write("[")
if stmt.expression:
f.write("expression %s" % (stmt.label, ))
else:
- f.write(stmt.label)
+ f.write('"%s"' % stmt.label)
if stmt.arguments is not None:
- if stmt.expression:
- f.write("pass ")
print_args(f, stmt.arguments)
- f.write('\n')
+ f.write('],\n')
def print_If(f, stmt, indent_level):
f.write("if %s:\n" % (stmt.entries[0][0], ))
@@ -429,21 +426,12 @@ def print_args(f, arginfo):
if arginfo is None:
return
- f.write("(")
-
- first = True
for (name, val) in arginfo.arguments:
- if first:
- first = False
- else:
- f.write(", ")
-
+ f.write(', ')
if name is not None:
f.write("%s = " % (name, ))
f.write(val)
- f.write(")")
-
# TODO positional?
def print_params(f, paraminfo):
f.write("(")
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index 11cbf78..f97a1f0 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -6,12 +6,13 @@ window.html5ks = {
persistent: {},
init: function () {
var defaultPersistent = {
+ version: 0,
fade: 100,
gotit: false,
hdisable: false,
skipUnread: false,
skipAfterChoices: false,
- useWebP: null,
+ useWebP: false,
fullscreen: false,
scaleAll: true,
scaleVideo: true,
@@ -23,6 +24,7 @@ window.html5ks = {
language: "en"
};
var loaded = localStorage.persistent ? JSON.parse(localStorage.persistent) : {};
+ html5ks.state._loaded = typeof loaded.version !== undefined;
var defProp = function (v) {
Object.defineProperty(html5ks.persistent, k, {
get: function () {
@@ -38,6 +40,18 @@ window.html5ks = {
for (var k in defaultPersistent) {
defProp(typeof loaded[k] === "undefined" ? defaultPersistent[k] : loaded[k]);
}
+
+ document.addEventListener("DOMContentLoaded", function () {
+ html5ks.onload();
+ }, false);
+
+ if (html5ks.state._loaded) {
+ var img = new Image();
+ img.onload = function () {
+ html5ks.persistent.useWebP = img.width === 4;
+ };
+ img.src = 'data:image/webp;base64,UklGRjgAAABXRUJQVlA4ICwAAAAQAgCdASoEAAQAAAcIhYWIhYSIgIIADA1gAAUAAAEAAAEAAP7%2F2fIAAAAA';
+ }
},
store: {
seen_scenes: {},
@@ -248,6 +262,3 @@ window.html5ks = {
}
};
html5ks.init();
-document.addEventListener("DOMContentLoaded", function () {
- html5ks.onload();
-}, false);