1
0
mirror of https://github.com/sehugg/8bitworkshop.git synced 2024-07-01 07:29:32 +00:00
8bitworkshop/jsnes/jsnes.min.js

2 lines
92 KiB
JavaScript
Raw Normal View History

2018-07-27 17:39:09 +00:00
!function(t,s){"object"==typeof exports&&"object"==typeof module?module.exports=s():"function"==typeof define&&define.amd?define("jsnes",[],s):"object"==typeof exports?exports.jsnes=s():t.jsnes=s()}("undefined"!=typeof self?self:this,function(){return function(t){function s(e){if(i[e])return i[e].exports;var h=i[e]={i:e,l:!1,exports:{}};return t[e].call(h.exports,h,h.exports,s),h.l=!0,h.exports}var i={};return s.m=t,s.c=i,s.d=function(t,i,e){s.o(t,i)||Object.defineProperty(t,i,{configurable:!1,enumerable:!0,get:e})},s.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(i,"a",i),i},s.o=function(t,s){return Object.prototype.hasOwnProperty.call(t,s)},s.p="",s(s.s=3)}([function(t,s){t.exports={copyArrayElements:function(t,s,i,e,h){for(var r=0;r<h;++r)i[e+r]=t[s+r]},copyArray:function(t){return t.slice(0)},fromJSON:function(t,s){for(var i=0;i<t.JSON_PROPERTIES.length;i++)t[t.JSON_PROPERTIES[i]]=s[t.JSON_PROPERTIES[i]]},toJSON:function(t){for(var s={},i=0;i<t.JSON_PROPERTIES.length;i++)s[t.JSON_PROPERTIES[i]]=t[t.JSON_PROPERTIES[i]];return s}}},function(t,s){var i=function(){this.state=new Array(8);for(var t=0;t<this.state.length;t++)this.state[t]=64};i.BUTTON_A=0,i.BUTTON_B=1,i.BUTTON_SELECT=2,i.BUTTON_START=3,i.BUTTON_UP=4,i.BUTTON_DOWN=5,i.BUTTON_LEFT=6,i.BUTTON_RIGHT=7,i.prototype={buttonDown:function(t){this.state[t]=65},buttonUp:function(t){this.state[t]=64}},t.exports=i},function(t,s){var i=function(){this.pix=new Array(64),this.fbIndex=null,this.tIndex=null,this.x=null,this.y=null,this.w=null,this.h=null,this.incX=null,this.incY=null,this.palIndex=null,this.tpri=null,this.c=null,this.initialized=!1,this.opaque=new Array(8)};i.prototype={setBuffer:function(t){for(this.y=0;this.y<8;this.y++)this.setScanline(this.y,t[this.y],t[this.y+8])},setScanline:function(t,s,i){for(this.initialized=!0,this.tIndex=t<<3,this.x=0;this.x<8;this.x++)this.pix[this.tIndex+this.x]=(s>>7-this.x&1)+((i>>7-this.x&1)<<1),0===this.pix[this.tIndex+this.x]&&(this.opaque[t]=!1)},render:function(t,s,i,e,h,r,n,a,o,l,p,u,m){if(!(r<-7||r>=256||n<-7||n>=240))if(this.w=e-s,this.h=h-i,r<0&&(s-=r),r+e>=256&&(e=256-r),n<0&&(i-=n),n+h>=240&&(h=240-n),l||p)if(l&&!p)for(this.fbIndex=(n<<8)+r,this.tIndex=7,this.y=0;this.y<8;this.y++){for(this.x=0;this.x<8;this.x++)this.x>=s&&this.x<e&&this.y>=i&&this.y<h&&(this.palIndex=this.pix[this.tIndex],this.tpri=m[this.fbIndex],0!==this.palIndex&&u<=(255&this.tpri)&&(t[this.fbIndex]=o[this.palIndex+a],this.tpri=3840&this.tpri|u,m[this.fbIndex]=this.tpri)),this.fbIndex++,this.tIndex--;this.fbIndex-=8,this.fbIndex+=256,this.tIndex+=16}else if(p&&!l)for(this.fbIndex=(n<<8)+r,this.tIndex=56,this.y=0;this.y<8;this.y++){for(this.x=0;this.x<8;this.x++)this.x>=s&&this.x<e&&this.y>=i&&this.y<h&&(this.palIndex=this.pix[this.tIndex],this.tpri=m[this.fbIndex],0!==this.palIndex&&u<=(255&this.tpri)&&(t[this.fbIndex]=o[this.palIndex+a],this.tpri=3840&this.tpri|u,m[this.fbIndex]=this.tpri)),this.fbIndex++,this.tIndex++;this.fbIndex-=8,this.fbIndex+=256,this.tIndex-=16}else for(this.fbIndex=(n<<8)+r,this.tIndex=63,this.y=0;this.y<8;this.y++){for(this.x=0;this.x<8;this.x++)this.x>=s&&this.x<e&&this.y>=i&&this.y<h&&(this.palIndex=this.pix[this.tIndex],this.tpri=m[this.fbIndex],0!==this.palIndex&&u<=(255&this.tpri)&&(t[this.fbIndex]=o[this.palIndex+a],this.tpri=3840&this.tpri|u,m[this.fbIndex]=this.tpri)),this.fbIndex++,this.tIndex--;this.fbIndex-=8,this.fbIndex+=256}else for(this.fbIndex=(n<<8)+r,this.tIndex=0,this.y=0;this.y<8;this.y++){for(this.x=0;this.x<8;this.x++)this.x>=s&&this.x<e&&this.y>=i&&this.y<h&&(this.palIndex=this.pix[this.tIndex],this.tpri=m[this.fbIndex],0!==this.palIndex&&u<=(255&this.tpri)&&(t[this.fbIndex]=o[this.palIndex+a],this.tpri=3840&this.tpri|u,m[this.fbIndex]=this.tpri)),this.fbIndex++,this.tIndex++;this.fbIndex-=8,this.fbIndex+=256}},isTransparent:function(t,s){return 0===this.pix[(s<<3)+t]},toJSON:function(){return{opaque:this.opaque,pix:this.pix}},fromJSON:function(t){this.opaque=t.opaque,this.pix=t.pix}},t.exports=i},function(t,s,i){t.exports={Controller:i(1),NES:i
//# sourceMappingURL=jsnes.min.js.map