summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2013-07-25 12:48:16 -0400
committerAlex Xu <alex_y_xu@yahoo.ca>2013-07-25 12:48:16 -0400
commit4db774c1ec0c0b20611fea938d2603e6a3dfe4ca (patch)
treeb41afaaee6cd85846b4bb68f692ee503e918e01c
parent23518a31d24e62caeecbfafe7708f4c7ffcd24f5 (diff)
downloadhtml5ks-4db774c1ec0c0b20611fea938d2603e6a3dfe4ca.tar.xz
html5ks-4db774c1ec0c0b20611fea938d2603e6a3dfe4ca.zip
pre-gzip script.json as part of build process
-rw-r--r--nginx.conf111
-rw-r--r--unrpyc/Makefile17
-rw-r--r--unrpyc/README2
-rw-r--r--www/js/html5ks.js15
4 files changed, 77 insertions, 68 deletions
diff --git a/nginx.conf b/nginx.conf
index fd33b24..db84ed0 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -1,12 +1,15 @@
events {
use epoll;
}
+
pid /dev/null;
error_log /dev/null;
+
http {
- client_body_temp_path /tmp/nginx-html5ks 1 2;
+
access_log /dev/null;
error_log stderr info;
+ client_body_temp_path /dev/null;
proxy_temp_path /dev/null;
fastcgi_temp_path /dev/null;
scgi_temp_path /dev/null;
@@ -33,7 +36,7 @@ http {
default_type application/octet-stream;
gzip on;
- gzip_min_length 1024;
+ gzip_static on;
gzip_types text/plain text/css application/javascript application/json;
gzip_vary on;
@@ -88,75 +91,75 @@ http {
location /dump/bgm/The_Student_Council.ogg { add_header X-Content-Duration "103"; }
location /dump/bgm/To_Become_One.ogg { add_header X-Content-Duration "248"; }
location /dump/bgm/Wiosna.ogg { add_header X-Content-Duration "70"; }
- location /dump/sfx/alarm.ogg { add_header X-Content-Duration "04.35"; }
+ location /dump/sfx/alarm.ogg { add_header X-Content-Duration "04.35"; }
location /dump/sfx/billiards_break.ogg { add_header X-Content-Duration "02.55"; }
- location /dump/sfx/billiards.ogg { add_header X-Content-Duration "01.14"; }
+ location /dump/sfx/billiards.ogg { add_header X-Content-Duration "01.14"; }
location /dump/sfx/birdstakeoff.ogg { add_header X-Content-Duration "04.91"; }
- location /dump/sfx/businterior.ogg { add_header X-Content-Duration "45.51"; }
- location /dump/sfx/camera.ogg { add_header X-Content-Duration "00.48"; }
- location /dump/sfx/can_clatter.ogg { add_header X-Content-Duration "03.01"; }
- location /dump/sfx/can.ogg { add_header X-Content-Duration "01.49"; }
- location /dump/sfx/carillon.ogg { add_header X-Content-Duration "11.85"; }
- location /dump/sfx/cellphone.ogg { add_header X-Content-Duration "03.77"; }
- location /dump/sfx/chaimu.ogg { add_header X-Content-Duration "05.36"; }
- location /dump/sfx/cicadas.ogg { add_header X-Content-Duration "27.90"; }
- location /dump/sfx/crowd_cheer.ogg { add_header X-Content-Duration "17.49"; }
+ location /dump/sfx/businterior.ogg { add_header X-Content-Duration "45.51"; }
+ location /dump/sfx/camera.ogg { add_header X-Content-Duration "00.48"; }
+ location /dump/sfx/can_clatter.ogg { add_header X-Content-Duration "03.01"; }
+ location /dump/sfx/can.ogg { add_header X-Content-Duration "01.49"; }
+ location /dump/sfx/carillon.ogg { add_header X-Content-Duration "11.85"; }
+ location /dump/sfx/cellphone.ogg { add_header X-Content-Duration "03.77"; }
+ location /dump/sfx/chaimu.ogg { add_header X-Content-Duration "05.36"; }
+ location /dump/sfx/cicadas.ogg { add_header X-Content-Duration "27.90"; }
+ location /dump/sfx/crowd_cheer.ogg { add_header X-Content-Duration "17.49"; }
location /dump/sfx/crowd_indoors.ogg { add_header X-Content-Duration "58.53"; }
- location /dump/sfx/crowd_outdoors.ogg { add_header X-Content-Duration "60.50"; }
- location /dump/sfx/crunch.ogg { add_header X-Content-Duration "00.75"; }
- location /dump/sfx/doorclose.ogg { add_header X-Content-Duration "00.79"; }
- location /dump/sfx/door_creak.ogg { add_header X-Content-Duration "03.25"; }
- location /dump/sfx/doorknock2.ogg { add_header X-Content-Duration "00.75"; }
- location /dump/sfx/doorknock.ogg { add_header X-Content-Duration "01.98"; }
- location /dump/sfx/dooropen.ogg { add_header X-Content-Duration "01.19"; }
- location /dump/sfx/doorslam.ogg { add_header X-Content-Duration "01.53"; }
+ location /dump/sfx/crowd_outdoors.ogg { add_header X-Content-Duration "60.50"; }
+ location /dump/sfx/crunch.ogg { add_header X-Content-Duration "00.75"; }
+ location /dump/sfx/doorclose.ogg { add_header X-Content-Duration "00.79"; }
+ location /dump/sfx/door_creak.ogg { add_header X-Content-Duration "03.25"; }
+ location /dump/sfx/doorknock2.ogg { add_header X-Content-Duration "00.75"; }
+ location /dump/sfx/doorknock.ogg { add_header X-Content-Duration "01.98"; }
+ location /dump/sfx/dooropen.ogg { add_header X-Content-Duration "01.19"; }
+ location /dump/sfx/doorslam.ogg { add_header X-Content-Duration "01.53"; }
location /dump/sfx/dropglasses.ogg { add_header X-Content-Duration "00.42"; }
- location /dump/sfx/dropstuff.ogg { add_header X-Content-Duration "02.00"; }
- location /dump/sfx/emibounce.ogg { add_header X-Content-Duration "02.00"; }
+ location /dump/sfx/dropstuff.ogg { add_header X-Content-Duration "02.00"; }
+ location /dump/sfx/emibounce.ogg { add_header X-Content-Duration "02.00"; }
location /dump/sfx/emijogging.ogg { add_header X-Content-Duration "42.00"; }
- location /dump/sfx/emipacing.ogg { add_header X-Content-Duration "06.28"; }
- location /dump/sfx/emirunning.ogg { add_header X-Content-Duration "07.63"; }
- location /dump/sfx/emisprinting.ogg { add_header X-Content-Duration "04.48"; }
- location /dump/sfx/fireworks.ogg { add_header X-Content-Duration "42.72"; }
- location /dump/sfx/flash.ogg { add_header X-Content-Duration "00.68"; }
+ location /dump/sfx/emipacing.ogg { add_header X-Content-Duration "06.28"; }
+ location /dump/sfx/emirunning.ogg { add_header X-Content-Duration "07.63"; }
+ location /dump/sfx/emisprinting.ogg { add_header X-Content-Duration "04.48"; }
+ location /dump/sfx/fireworks.ogg { add_header X-Content-Duration "42.72"; }
+ location /dump/sfx/flash.ogg { add_header X-Content-Duration "00.68"; }
location /dump/sfx/footsteps_hard.ogg { add_header X-Content-Duration "02.69"; }
location /dump/sfx/footsteps_soft.ogg { add_header X-Content-Duration "02.64"; }
- location /dump/sfx/hammer.ogg { add_header X-Content-Duration "00.75"; }
+ location /dump/sfx/hammer.ogg { add_header X-Content-Duration "00.75"; }
location /dump/sfx/heart_single_fast.ogg { add_header X-Content-Duration "01.19"; }
location /dump/sfx/heart_single_slow.ogg { add_header X-Content-Duration "01.98"; }
location /dump/sfx/heart_stop.ogg { add_header X-Content-Duration "00.85"; }
location /dump/sfx/hollowclick.ogg { add_header X-Content-Duration "00.34"; }
- location /dump/sfx/lighter.ogg { add_header X-Content-Duration "03.15"; }
- location /dump/sfx/lock.ogg { add_header X-Content-Duration "00.68"; }
- location /dump/sfx/paper.ogg { add_header X-Content-Duration "00.92"; }
+ location /dump/sfx/lighter.ogg { add_header X-Content-Duration "03.15"; }
+ location /dump/sfx/lock.ogg { add_header X-Content-Duration "00.68"; }
+ location /dump/sfx/paper.ogg { add_header X-Content-Duration "00.92"; }
location /dump/sfx/paperruffling.ogg { add_header X-Content-Duration "10.17"; }
location /dump/sfx/parkambience.ogg { add_header X-Content-Duration "28.93"; }
- location /dump/sfx/phone.ogg { add_header X-Content-Duration "02.25"; }
- location /dump/sfx/pillow.ogg { add_header X-Content-Duration "01.04"; }
- location /dump/sfx/rain.ogg { add_header X-Content-Duration "88.40"; }
- location /dump/sfx/rooftop.ogg { add_header X-Content-Duration "50.09"; }
- location /dump/sfx/rumble.ogg { add_header X-Content-Duration "04.03"; }
- location /dump/sfx/rustling.ogg { add_header X-Content-Duration "01.99"; }
- location /dump/sfx/scratch.ogg { add_header X-Content-Duration "00.40"; }
- location /dump/sfx/shower.ogg { add_header X-Content-Duration "12.16"; }
- location /dump/sfx/skid2.ogg { add_header X-Content-Duration "02.20"; }
- location /dump/sfx/slide2.ogg { add_header X-Content-Duration "00.51"; }
- location /dump/sfx/slide.ogg { add_header X-Content-Duration "01.36"; }
- location /dump/sfx/snap.ogg { add_header X-Content-Duration "00.32"; }
+ location /dump/sfx/phone.ogg { add_header X-Content-Duration "02.25"; }
+ location /dump/sfx/pillow.ogg { add_header X-Content-Duration "01.04"; }
+ location /dump/sfx/rain.ogg { add_header X-Content-Duration "88.40"; }
+ location /dump/sfx/rooftop.ogg { add_header X-Content-Duration "50.09"; }
+ location /dump/sfx/rumble.ogg { add_header X-Content-Duration "04.03"; }
+ location /dump/sfx/rustling.ogg { add_header X-Content-Duration "01.99"; }
+ location /dump/sfx/scratch.ogg { add_header X-Content-Duration "00.40"; }
+ location /dump/sfx/shower.ogg { add_header X-Content-Duration "12.16"; }
+ location /dump/sfx/skid2.ogg { add_header X-Content-Duration "02.20"; }
+ location /dump/sfx/slide2.ogg { add_header X-Content-Duration "00.51"; }
+ location /dump/sfx/slide.ogg { add_header X-Content-Duration "01.36"; }
+ location /dump/sfx/snap.ogg { add_header X-Content-Duration "00.32"; }
location /dump/sfx/stallbuilding.ogg { add_header X-Content-Duration "28.93"; }
location /dump/sfx/startpistol.ogg { add_header X-Content-Duration "03.58"; }
location /dump/sfx/startpistol.trim.ogg { add_header X-Content-Duration "02.27"; }
- location /dump/sfx/storebell.ogg { add_header X-Content-Duration "03.62"; }
- location /dump/sfx/switch.ogg { add_header X-Content-Duration "00.34"; }
- location /dump/sfx/sword_draw.ogg { add_header X-Content-Duration "00.85"; }
- location /dump/sfx/tcard.ogg { add_header X-Content-Duration "14.43"; }
- location /dump/sfx/teacup.ogg { add_header X-Content-Duration "01.74"; }
+ location /dump/sfx/storebell.ogg { add_header X-Content-Duration "03.62"; }
+ location /dump/sfx/switch.ogg { add_header X-Content-Duration "00.34"; }
+ location /dump/sfx/sword_draw.ogg { add_header X-Content-Duration "00.85"; }
+ location /dump/sfx/tcard.ogg { add_header X-Content-Duration "14.43"; }
+ location /dump/sfx/teacup.ogg { add_header X-Content-Duration "01.74"; }
location /dump/sfx/thunder.ogg { add_header X-Content-Duration "04.86"; }
- location /dump/sfx/time.ogg { add_header X-Content-Duration "03.14"; }
- location /dump/sfx/time.trim.ogg { add_header X-Content-Duration "02.13"; }
- location /dump/sfx/traffic.ogg { add_header X-Content-Duration "60.62"; }
- location /dump/sfx/trainint.ogg { add_header X-Content-Duration "08.80"; }
- location /dump/sfx/whiteout.ogg { add_header X-Content-Duration "01.82"; }
+ location /dump/sfx/time.ogg { add_header X-Content-Duration "03.14"; }
+ location /dump/sfx/time.trim.ogg { add_header X-Content-Duration "02.13"; }
+ location /dump/sfx/traffic.ogg { add_header X-Content-Duration "60.62"; }
+ location /dump/sfx/trainint.ogg { add_header X-Content-Duration "08.80"; }
+ location /dump/sfx/whiteout.ogg { add_header X-Content-Duration "01.82"; }
location /dump/sfx/wumph_2.ogg { add_header X-Content-Duration "00.53"; }
location /dump/sfx/wumph.ogg { add_header X-Content-Duration "01.00"; }
}
diff --git a/unrpyc/Makefile b/unrpyc/Makefile
index 6a94ca6..0463da9 100644
--- a/unrpyc/Makefile
+++ b/unrpyc/Makefile
@@ -1,10 +1,19 @@
-all: $(patsubst %.rpyc,%.json,$(wildcard *.rpyc))
+all: script.json.gz
-%.json.o: %.rpyc *.py
+script.json.gz: script.json
+ gzip -c script.json > script.json.gz
+ touch script.json script.json.gz
+
+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
python unrpyc.py --clobber $< $@
-%.json: %.json.o
+script-%.json: script-%.json.o
node fix.js $< $@
+ sed -i -e 's/^{//;s/}$$/,/' $@
clean:
rm -f *.json.o *.json
@@ -13,6 +22,6 @@ test: all
jshint --show-non-errors *.json
install: all
- install -t ../www/scripts *.json
+ install -t ../www/scripts script.json script.json.gz
.PHONY: all clean test install
diff --git a/unrpyc/README b/unrpyc/README
index ba1791f..9e4ef50 100644
--- a/unrpyc/README
+++ b/unrpyc/README
@@ -8,7 +8,7 @@ How to use:
2. Execute "2to3 -w renpy/*.py".
3. Put the rpyc files from the official KS distribution in here.
4. Run "make" with appropriate -j options (yay auto-parallelization)
-5. Run "make install".
+5. Run "make install". Alternatively, move "script.json" into /www/scripts.
If you're on Windows, sucks for you. Use a better OS.
diff --git a/www/js/html5ks.js b/www/js/html5ks.js
index 059cbbe..0c2c1f7 100644
--- a/www/js/html5ks.js
+++ b/www/js/html5ks.js
@@ -172,7 +172,7 @@ window.html5ks = {
}
},
start: function () {
- this.fetch("script", "a1-monday").then(function () {
+ this.fetch("script").then(function () {
html5ks.api.movie_cutscene("4ls", true).then(function () {
html5ks.menu.mainMenu();
});
@@ -183,18 +183,15 @@ window.html5ks = {
var xhr = new XMLHttpRequest();
switch (type) {
case "script":
- var script = html5ks.data.script;
- if (script[name]) {
+ if (html5ks.data._scriptFetched) {
deferred.resolve();
} else {
- xhr.open("GET", "scripts/script-" + name + ".json");
+ xhr.open("GET", "scripts/script.json");
xhr.onreadystatechange = function () {
- script[name] = true;
if (xhr.readyState === 4) {
- var resp = JSON.parse(xhr.responseText);
- for (var label in resp) {
- script[label] = resp[label];
- }
+ html5ks.data._scriptFetched = true;
+ var script = JSON.parse(xhr.responseText);
+ html5ks.data.script = script;
deferred.resolve();
}
};