Skip to content
This repository
Browse code

WiiU official support

  • Loading branch information...
commit f3ac823cfdb02c9d632cc4712e8962eb70f93185 1 parent cccd835
Francesco Cottone authored

Showing 1 changed file with 46 additions and 2 deletions. Show diff stats Hide diff stats

  1. +46 2 akihabara/help.js
48 akihabara/help.js
@@ -453,7 +453,9 @@ var help={
453 453 */
454 454 getDeviceConfig:function() {
455 455 var cap;
456   - if (navigator.userAgent.match(/nintendo wii/i))
  456 + if (navigator.userAgent.match(/nintendo wiiu/i)&&window.wiiu)
  457 + cap={iswiiu:true,height:598}
  458 + else if (navigator.userAgent.match(/nintendo wii/i))
457 459 cap={iswii:true,height:window.innerHeight,doublebuffering:true} // Simulated double buffering has been resumed. Canvas on Opera for Wii has a strange sprite blinking effect - usually browsers render frames once ended and this is an exception.
458 460 else if (navigator.userAgent.match(/iPhone/i)||navigator.userAgent.match(/iPod/i) || navigator.userAgent.match(/Android/i))
459 461 cap={touch:true,width:320};
@@ -528,7 +530,49 @@ var help={
528 530 b:172,
529 531 c:13
530 532 };
531   - document.onkeypress= function(e){ if (e.preventDefault) e.preventDefault(); return false};
  533 + document.onkeypress= gbox._prevent;
  534 + }
  535 + if (device.iswiiu) {
  536 + gbox._keymap={
  537 + left:9002,
  538 + right:9003,
  539 + up:9000,
  540 + down:9001,
  541 + a:9100,
  542 + b:9107,
  543 + c:9108
  544 + };
  545 + gbox._controlscallback=function(gbox) {
  546 + var state = window.wiiu.gamepad.update();
  547 + if( !state.isEnabled || !state.isDataValid ) return;
  548 + var h=state.hold& 0x7f86fffc;
  549 + var map={
  550 + 9000:((h&0x00000200)||(h&0x10000000)||(h&0x01000000)), // up
  551 + 9001:((h&0x00000100)||(h&0x00800000)||(h&0x08000000)), // down
  552 + 9002:((h&0x00000800)||(h&0x40000000)||(h&0x04000000)), // left
  553 + 9003:((h&0x00000400)||(h&0x20000000)||(h&0x02000000)), // right
  554 + 9100:(h&0x00008000), // A
  555 + 9101:(h&0x00004000), // B
  556 + 9102:(h&0x00002000), // X
  557 + 9103:(h&0x00001000), // Y
  558 + 9104:(h&0x00000080), // ZL
  559 + 9105:(h&0x00000040), // ZR
  560 + 9106:(h&0x00000020), // L
  561 + 9107:(h&0x00000010), // R
  562 + 9108:(h&0x00000008), //+
  563 + 9109:(h&0x00000004) // -
  564 + }
  565 + if (!gbox._oldmap) gbox._oldmap={};
  566 + for (var a in map)
  567 + if (map[a]&&!gbox._oldmap[a]) gbox._keyboard[a]=1; else
  568 + if (!map[a]&&gbox._oldmap[a]) gbox._keyboard[a]=-1;
  569 + gbox._oldmap=map;
  570 + }
  571 + document.onkeypress= gbox._prevent;
  572 + var meta=document.createElement("meta");
  573 + meta.setAttribute("name","viewport");
  574 + meta.setAttribute("content","width=1280 height=598 user-scalable=no");
  575 + document.getElementsByTagName("head")[0].appendChild(meta);
532 576 }
533 577 if (!data.splash||(data.splash.minilogo==null)) gbox.setSplashSettings({minilogo:"logo"});
534 578 if (!data.splash||(data.splash.background==null)) gbox.setSplashSettings({background:"akihabara/splash.png"});

0 comments on commit f3ac823

Please sign in to comment.
Something went wrong with that request. Please try again.