Skip to content

Commit

Permalink
More formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
AeonLucid committed Aug 20, 2019
1 parent 5542f52 commit cede466
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion androidemu/emulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def _enable_vfp(self):
def load_library(self, filename, do_init=True):
libmod = self.modules.load_module(filename)
if do_init:
logger.debug("Calling Init for: %s " % filename)
logger.debug("Calling init for: %s " % filename)
for fun_ptr in libmod.init_array:
logger.debug("Calling Init function: %x " % fun_ptr)
self.call_native(fun_ptr)
Expand Down
10 changes: 8 additions & 2 deletions androidemu/utils/memory_helpers.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import hexdump
import struct


def hex_dump(mu, address, size):
data = mu.mem_read(address, size)
return hexdump.hexdump(data)
Expand All @@ -9,9 +10,11 @@ def hex_dump(mu, address, size):
def read_ptr(mu, address):
return int.from_bytes(mu.mem_read(address, 4), byteorder='little')


def read_byte_array(mu, address, size):
return mu.mem_read(address, size)


def read_utf8(mu, address):
buffer_address = address
buffer_read_size = 32
Expand All @@ -28,13 +31,16 @@ def read_utf8(mu, address):

return buffer[:null_pos].decode("utf-8")

def read_uints(mu, address, num = 1):

def read_uints(mu, address, num=1):
data = mu.mem_read(address, num * 4)
return struct.unpack("I"*num,data)
return struct.unpack("I" * num, data)


def write_utf8(mu, address, value):
mu.mem_write(address, value.encode(encoding="utf-8") + b"\x00")


def write_uints(mu, address, num):
l = []
if not isinstance(num, list):
Expand Down

0 comments on commit cede466

Please sign in to comment.