-
Notifications
You must be signed in to change notification settings - Fork 53
/
tool-settings.html
248 lines (227 loc) · 9.29 KB
/
tool-settings.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<html>
<head>
<script type="text/javascript" src="akihabara/gbox.js"></script>
<script type="text/javascript" src="akihabara/help.js"></script>
<style>
body *{font-size:17px;font-family: Georgia, "Times New Roman", Times, serif;}
H1 { font-size:20px; text-align:right}
H2 { font-size:20px;line-height:0px; }
.settingsbox { border:1px solid black;padding:10px;margin:0px 0px 10px 0px; border-radius: 5px;-moz-border-radius: 5px; -webkit-border-radius: 5px; -moz-box-shadow:0 0 5px #000000; -webkit-box-shadow:0 0 5px #000000; box-shadow:0 0 5px #000000;}
.settingsbox P { font-size:15px }
.settingsbox P * { font-size:15px }
.settingsbox UL { list-style-type: none; padding: 5px;margin: 0; }
.settingsbox LI { line-height:40px; font-size:15px }
.settingsbox .keymap { background-color:white;position:absolute;left:250px; width:400px;padding-left:5px }
.settingsbox .selector { position:absolute;left:250px; width:300px;padding:5px;margin:5px 0px 0px 0px; }
.gameboxkeyboard { background-color:#debebe }
.gameboxaudio { background-color:#debebe }
.gameboxexperimental { background-color:#fecede }
.gameboxsave { background-color:#debebe }
</style>
<title>Akihabara setup</title>
</head>
<body onkeydown="return dokeycustomized(event)" onkeypress="return false" onkeyup="return false" onload="loaddata()">
<h1>Akihabara setup</h1>
<div class="settingsbox gameboxkeyboard">
<h2>Gamebox buttons setup</h2>
<p>These settings will be used by any Gamebox game hosted by this domain. Click a box and press a key to customize.</p>
<ul>
<li> Up <span class="keymap" id="keyup" READONLY onclick="customizekey({key:'up',input:'keyup'})"></span></li>
<li> Down <span class="keymap" id="keydown" READONLY onclick="customizekey({key:'down',input:'keydown'})"></span></li>
<li> Left <span class="keymap" id="keyleft" READONLY onclick="customizekey({key:'left',input:'keyleft'})"></span></li>
<li> Right <span class="keymap" id="keyright" READONLY onclick="customizekey({key:'right',input:'keyright'})"></span></li>
<li> A Button <span class="keymap" id="keya" READONLY onclick="customizekey({key:'a',input:'keya'})"></span></li>
<li> B Button <span class="keymap" id="keyb" READONLY onclick="customizekey({key:'b',input:'keyb'})"></span></li>
<li> C Button <span class="keymap" id="keyc" READONLY onclick="customizekey({key:'c',input:'keyc'})"></span></li>
</ul>
<span id="extra">
</div>
<div class="settingsbox gameboxaudio">
<h2>Gamebox audio setup</h2>
<p>These settings will be used by any Gamebox game hosted by this domain. <b>Audio is still in beta</b> and is available on some browsers by default.</p>
<ul>
<li><input type="checkbox" id="noaudio" onclick="checkflag(this)"> Disable audio</li>
</ul>
</div>
<div class="settingsbox gameboxaudio">
<h2>Gamebox screen setup</h2>
<p>These settings will be used by any Gamebox game hosted by this domain.</p>
<ul>
<li>Loading screen <select class="selector" id="loadscreen" onchange="changedselect(this)">
<option value="normal">Classic</option>
<option value="c64">Joseph64</option>
</select></li>
<li>Full screen effects <select class="selector" id="fse" onchange="changedselect(this)">
<option value="none">None</option>
<option value="scanlines">Scanlines</option>
<option value="lcd">LCD</option>
</select></li>
</ul>
</div>
<div class="settingsbox gameboxexperimental">
<h2>Gamebox experimental</h2>
<p>This checkbox enables misc experimental features <b>that are really unstable</b>. Use at yout own risk!</p>
<ul>
<li><input type="checkbox" id="experimental" onclick="checkflag(this)"> Enable experimental features</li>
</ul>
<p><i>Experimental features are: iPad with 3.6 firmware, iPhone with 4.x betas (single channel mode), IE9 Beta in IE7 Compat mode, latest builds of Konqueror (single channle mode) and all other audio-enabled devices (untested)</i></p>
</div>
<div class="settingsbox gameboxsave">
<input type="button" onclick="resetdefaults()" value="Reset default settings">
<input type="button" onclick="savesettings()" value="Save settings">
</div>
</body>
<script>
var defaults={
flags:help.cloneObject(gbox._flags)
};
var customizing=null;
var device;
function pjq(id) { return document.getElementById(id) };
function keyidtostring(id) {
var strkey="";
switch (id) {
case 38: { strkey="Up arrow"; break }
case 40: { strkey="Down arrow"; break }
case 37: { strkey="Left arrow"; break }
case 39: { strkey="Right arrow"; break }
default: {
if (((id>64)&&(id<133))||((id>47)&&(id<58))) strkey=String.fromCharCode(id);
}
}
if (device.iswii) {
switch (id) {
case 175: { strkey="Wiimote D-Pad left"; break; }
case 176: { strkey="Wiimote D-Pad right"; break; }
case 177: { strkey="Wiimote D-Pad up"; break; }
case 178: { strkey="Wiimote D-Pad down"; break; }
case 173: { strkey="Wiimote 2 button"; break; }
case 174: { strkey="Wiimote + button"; break; }
case 170: { strkey="Wiimote - button"; break; }
case 172: { strkey="Wiimote 1 button"; break; }
case 13: { strkey="Wiimote A button"; break; }
}
}
if (device.iswiiu) {
switch (id) {
case 9002: { strkey="WiiU Gamepad D-Pad/Analog left"; break; }
case 9003: { strkey="WiiU Gamepad D-Pad/Analog right"; break; }
case 9000: { strkey="WiiU Gamepad D-Pad/Analog up"; break; }
case 9001: { strkey="WiiU Gamepad D-Pad/Analog down"; break; }
case 9100: { strkey="WiiU Gamepad A button"; break; }
case 9101: { strkey="WiiU Gamepad B button"; break; }
case 9102: { strkey="WiiU Gamepad X button"; break; }
case 9103: { strkey="WiiU Gamepad Y button"; break; }
case 9104: { strkey="WiiU Gamepad ZL button"; break; }
case 9105: { strkey="WiiU Gamepad ZR button"; break; }
case 9106: { strkey="WiiU Gamepad L button"; break; }
case 9107: { strkey="WiiU Gamepad R button"; break; }
case 9108: { strkey="WiiU Gamepad + button"; break; }
case 9109: { strkey="WiiU Gamepad - button"; break; }
}
}
return "key "+id+(strkey?" ("+strkey+")":"");
}
function updatescreen() {
pjq("keyup").innerHTML=keyidtostring(gbox._keymap["up"]);
pjq("keydown").innerHTML=keyidtostring(gbox._keymap["down"]);
pjq("keyleft").innerHTML=keyidtostring(gbox._keymap["left"]);
pjq("keyright").innerHTML=keyidtostring(gbox._keymap["right"]);
pjq("keya").innerHTML=keyidtostring(gbox._keymap["a"]);
pjq("keyb").innerHTML=keyidtostring(gbox._keymap["b"]);
pjq("keyc").innerHTML=keyidtostring(gbox._keymap["c"]);
for (var i in gbox._flags) {
switch (gbox._flagstype[i]) {
case "check": {
pjq(i).checked=gbox._flags[i];
break;
}
case "list":{
for (var j=0;j<pjq(i).options.length;j++)
if (pjq(i).options[j].value==gbox._flags[i]) {
pjq(i).selectedIndex=j;
break;
}
break;
}
}
}
}
function checkflag(t) {
gbox._flags[t.id]=(t.checked?true:false);
}
function loaddata() {
device=help.akihabaraInit({hardwareonly:true});
defaults.defaultkeymap=help.cloneObject(gbox._keymap);
gbox._loadsettings();
defaults.keyboardkeymap=help.cloneObject(gbox._keymap);
if (device.iswii)
pjq("extra").innerHTML="<div style='margin-top:10px'><input type=button value='Set USB keyboard default' onclick='setusbkeyboarddefault()'><\/div>";
if (device.iswiiu)
pjq("extra").innerHTML="<p>Only few button are usable on WiiU because most of them are doing something on the browser and default actions are not cancellable for now. For now only the A, R, + and - buttons seems usable.</p><div style='margin-top:10px'><input type=button value='Set single button controls' onclick='setsinglebuttonscontrols()'><\/div>";
updatescreen();
}
function changedselect(t) {
gbox._flags[t.id]=t.options[t.selectedIndex].value;
}
function customizekey(p) {
cancelcustomize();
customizing=p;
pjq(customizing.input).style.backgroundColor="#cefede";
if (gbox._controlscallback) {
customizing.timer=setInterval(function(){
gbox._controlscallback(gbox);
for (var a in gbox._keyboard)
if (gbox._keyboard[a]>0) {
keycustomized({fake:true,keyCode:a*1});
break;
}
},gbox._mspf);
}
}
function cancelcustomize() {
if (customizing) {
if (customizing.timer) clearTimeout(customizing.timer);
pjq(customizing.input).style.backgroundColor="";
updatescreen();
customizing=null;
}
}
function keycustomized(e) {
if (customizing) {
gbox._keymap[customizing.key]=(e.fake||window.event?e.keyCode:e.which);
cancelcustomize();
return false;
}
}
function dokeycustomized(e){
if (!gbox._controlscallback) keycustomized(e);
return false;
}
function resetdefaults() {
if (confirm("Revert to default configuration?")) {
gbox._keymap=help.cloneObject(defaults.defaultkeymap);
gbox._flags=help.cloneObject(defaults.flags);
updatescreen();
}
}
function savesettings() {
gbox._savesettings();
alert("Settings saved succesfully.");
}
function setusbkeyboarddefault() {
if (confirm("Set the USB keyboard default input settings?")) {
gbox._keymap=help.cloneObject(defaults.keyboardkeymap);
updatescreen();
}
}
function setsinglebuttonscontrols() {
if (confirm("Set the WiiU single button default input settings?")) {
gbox._keymap.a=9100;
gbox._keymap.b=9100;
gbox._keymap.c=9100;
updatescreen();
}
}
</script>
</html>