Skip to content

Commit

Permalink
Adding calculator
Browse files Browse the repository at this point in the history
  • Loading branch information
yhs0602 committed Jan 21, 2019
1 parent 4e4cfa7 commit eafb189
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 21 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ You can download the theme.zip here.
- Better support for thumb assemblies
- Support .NET assemblies
- Add compatibility for OllyDbg's `.udd/.bak` files
- Add compatibility for IDA's produce files.
- About to add Hex view, calculator, and any other utilities.
- About to post this app on the play store!

# Help wanted!
- Don't the symbols' names look odd?
Expand Down
36 changes: 36 additions & 0 deletions app/src/main/java/com/kyhsgeekcode/disassembler/HexManager.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,42 @@
package com.kyhsgeekcode.disassembler;
import android.widget.*;

public class HexManager
{
private final static char[] hexArray = "0123456789ABCDEF".toCharArray();
byte [] bytes;
String sep=System.lineSeparator();
public void Show(TextView tv,int startaddress)
{
//show n bytes from startaddress
startaddress/=16;
startaddress*=16;
StringBuilder sb=new StringBuilder();
for(int i=startaddress;i<startaddress+12800;i++)
{
if(i>=bytes.length)
{
break;
}
int v = bytes[i] & 0xff;
sb.append(hexArray[v >>> 4]);
sb.append(hexArray[v & 0x0f]);
if(i%16==15)
{
sb.append(sep);
sb.append(" ");
//sb.append(i>>>4);
}else{
sb.append(" ");
}
}
tv.setText(sb.toString().trim());
}
public HexManager(){
bytes=new byte[1];
}
public void setBytes(byte[] b)
{
bytes=b;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,14 @@ public class MainActivity extends AppCompatActivity implements Button.OnClickLis

private Notification.Builder mBuilder;

private static final int TAB_EXPORT = 2;
private static final int TAB_EXPORT = 3;

private static final int TAB_DISASM = 3;
private static final int TAB_DISASM = 4;

private ColumnSetting columnSetting=new ColumnSetting();

HexManager hexManager=new HexManager();

public ColumnSetting getColumns()
{
return columnSetting;
Expand Down Expand Up @@ -2319,7 +2321,8 @@ private void AfterReadFully(File file) throws IOException
{
// symAdapter.setCellItems(list);
getSupportActionBar().setTitle("Disassembler("+file.getName()+")");
tvHex.setText(getHexString());
hexManager.setBytes(filecontent);
hexManager.Show(tvHex,0);
try
{
setParsedFile(new ELFUtil(file,filecontent));
Expand Down
Loading

0 comments on commit eafb189

Please sign in to comment.