forked from AeonLucid/AndroidNativeEmu
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added specific syscall overrides and partial super class support
- Loading branch information
Showing
13 changed files
with
123 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
class EmulatorError(Exception): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from androidemu.java.java_class_def import JavaClassDef | ||
from androidemu.java.java_field_def import JavaFieldDef | ||
|
||
|
||
class Executable(metaclass=JavaClassDef, | ||
jvm_name='java/lang/reflect/Executable', | ||
jvm_fields=[ | ||
JavaFieldDef('accessFlags', 'I', False) | ||
]): | ||
|
||
def __init__(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,44 @@ | ||
from androidemu.java.classes.constructor import Constructor | ||
import logging | ||
|
||
from androidemu.emulator_error import EmulatorError | ||
from androidemu.java.classes.executable import Executable | ||
from androidemu.java.java_class_def import JavaClassDef | ||
from androidemu.java.java_field_def import JavaFieldDef | ||
from androidemu.java.java_method_def import java_method_def, JavaMethodDef | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
class Method(metaclass=JavaClassDef, | ||
jvm_name='java/lang/reflect/Method', | ||
jvm_fields=[ | ||
JavaFieldDef('slot', 'I', False), | ||
JavaFieldDef('declaringClass', 'Ljava/lang/Class;', False), | ||
]): | ||
], | ||
jvm_super=Executable): | ||
|
||
def __init__(self, clazz: JavaClassDef, method: JavaMethodDef): | ||
super().__init__() | ||
self._clazz = clazz | ||
self._method = method | ||
self.slot = method.jvm_id | ||
self.declaringClass = self._clazz | ||
self.accessFlags = method.modifier | ||
|
||
@staticmethod | ||
@java_method_def( | ||
name="getMethodModifiers", | ||
signature="(Ljava/lang/Class;I)I", | ||
args_list=['jobject', 'jint'] | ||
args_list=['jobject', 'jint'], | ||
ignore=True | ||
) | ||
def get_method_modifiers(emu, clazz_obj, jvm_method_id): | ||
clazz = clazz_obj.value | ||
method = clazz.find_method_by_id(jvm_method_id) | ||
|
||
# TODO: Implement | ||
logger.debug('get_method_modifiers(%s, %s)' % (clazz.jvm_name, method.name)) | ||
|
||
if method.modifier is None: | ||
raise EmulatorError('No modifier was given to class %s method %s' % (clazz.jvm_name, method.name)) | ||
|
||
return 0 | ||
return method.modifier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# https://docs.oracle.com/javase/7/docs/api/constant-values.html | ||
|
||
MODIFIER_PUBLIC = 1 | ||
MODIFIER_PRIVATE = 2 | ||
MODIFIER_PROTECTED = 4 | ||
MODIFIER_STATIC = 8 | ||
MODIFIER_FINAL = 16 | ||
MODIFIER_SYNCHRONIZED = 32 | ||
MODIFIER_VOLATILE = 64 | ||
MODIFIER_TRANSIENT = 128 | ||
MODIFIER_NATIVE = 256 | ||
MODIFIER_INTERFACE = 512 | ||
MODIFIER_ABSTRACT = 1024 | ||
MODIFIER_STRICT = 2048 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters