mirror of
https://github.com/radareorg/radare2.git
synced 2024-12-11 15:04:23 +00:00
1 line
2.3 KiB
JavaScript
1 line
2.3 KiB
JavaScript
function docss(t){return"<font color=black>"+t+"</font>"}enyo.kind({name:"DisassemblerOld",kind:"Scroller",tag:"div",style:"margin:0px;background-color:#c0c0c0",data:null,components:[{tag:"div",allowHtml:!0,classes:"colorbar",name:"colorbar"},{tag:"br"},{tag:"div",content:"^",classes:"moreless",ontap:"less"},{tag:"pre",allowHtml:!0,name:"text",content:"..",style:"margin-left:5px"},{tag:"div",content:"v",classes:"moreless",ontap:"more"}],min:0,max:0,block:512,base:"entry0",less:function(){var t=this.$.text;this.min+=this.block,r2.get_disasm(this.base+"-"+this.min,this.block,function(e){e=docss(r2.filter_asm(e,"pd"));var s=r2ui._dis.getScrollBounds().height;t.setContent("<div class='enyo-selectable'>"+e+t.getContent()+"</div>");var i=r2ui._dis.getScrollBounds().height;r2ui._dis.scrollTo(0,i-s)})},more:function(){var t=this.$.text;this.max+=this.block,r2.get_disasm(this.base+"+"+this.max,this.block,function(e){e=docss(r2.filter_asm(e,"pd")),t.setContent("<div class='enyo-selectable'>"+t.getContent()+e+"</div>")})},seek:function(t){var e=this.$.text;this.base=t,this.min=this.max=0,r2.get_disasm(t,this.block,function(t){t=docss(r2.filter_asm(t,"pd")),e.setContent("<div class='enyo-selectable'>"+t+"</div>")}),this.scrollTo(0,0)},create:function(){this.inherited(arguments);this.$.text;r2.cmd("e asm.lineswidth = 20",function(t){}),this.seek("entry0"),r2ui._dis=this,r2ui.history_push("entry0")},colorbar_create:function(){var t=this;r2.cmd("p-j 24",function(e){try{var s=JSON.parse(e)}catch(i){return void alert(i)}console.log(s);for(var o="<table class='colorbar'><tr valign=top style='height:8px;border-spacing:0'>",r={flags:"#c0c0c0",comments:"yellow",functions:"#5050f0",strings:"orange"},n="",l=16,a=0;a<s.blocks.length;a++){var c=s.blocks[a],d="<div style='overflow:hidden;width:12px;'>____</div>";if(c.offset){var d="<table width='width:100%' height="+l+" style='border-spacing:0px'>",h=0;for(var b in r)c[b]&&h++;if(h++,1==h)break;var m=l/h;for(var b in r){r[b];c[b]&&(d+="<tr><td class='colorbar_item' style='background-color:"+r[b]+"'><div style='width:12px;overflow:hidden;height:"+m+"px'>____</div></td></tr>")}d+="</table>",n="0x"+c.offset.toString(16)}else n="0x"+(s.from+s.blocksize*a).toString(16);o+="<td onclick='r2ui.seek("+n+",true)' title='"+n+"' style='height:"+l+"px' width=15px>"+d+"</td>"}o+="</tr></table>",t.$.colorbar.setContent(o)})}}); |