From 42aafa19f1d3e59c5ae05c8f18a4e26f7ef21f21 Mon Sep 17 00:00:00 2001 From: bwall Date: Fri, 25 Sep 2015 10:12:33 -0400 Subject: [PATCH 1/2] Patch resubmission --- src/pylibemu.c | 3441 +++++++++++++++++++++++++--------------------- src/pylibemu.pyx | 3 + 2 files changed, 1849 insertions(+), 1595 deletions(-) diff --git a/src/pylibemu.c b/src/pylibemu.c index 484c047..d1533c8 100644 --- a/src/pylibemu.c +++ b/src/pylibemu.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.20.2 on Wed Jul 30 11:54:37 2014 */ +/* Generated by Cython 0.21.1 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -16,11 +16,11 @@ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. -#elif PY_VERSION_HEX < 0x02040000 - #error Cython requires Python 2.4+. +#elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000) + #error Cython requires Python 2.6+ or Python 3.2+. #else -#define CYTHON_ABI "0_20_2" -#include /* For offsetof */ +#define CYTHON_ABI "0_21_1" +#include #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif @@ -57,62 +57,8 @@ #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 #define Py_OptimizeFlag 0 #endif -#if PY_VERSION_HEX < 0x02050000 - typedef int Py_ssize_t; - #define PY_SSIZE_T_MAX INT_MAX - #define PY_SSIZE_T_MIN INT_MIN - #define PY_FORMAT_SIZE_T "" - #define CYTHON_FORMAT_SSIZE_T "" - #define PyInt_FromSsize_t(z) PyInt_FromLong(z) - #define PyInt_AsSsize_t(o) __Pyx_PyInt_As_int(o) - #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ - (PyErr_Format(PyExc_TypeError, \ - "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ - (PyObject*)0)) - #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ - !PyComplex_Check(o)) - #define PyIndex_Check __Pyx_PyIndex_Check - #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) - #define __PYX_BUILD_PY_SSIZE_T "i" -#else - #define __PYX_BUILD_PY_SSIZE_T "n" - #define CYTHON_FORMAT_SSIZE_T "z" - #define __Pyx_PyIndex_Check PyIndex_Check -#endif -#if PY_VERSION_HEX < 0x02060000 - #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) - #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) - #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) - #define PyVarObject_HEAD_INIT(type, size) \ - PyObject_HEAD_INIT(type) size, - #define PyType_Modified(t) - typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; - } Py_buffer; - #define PyBUF_SIMPLE 0 - #define PyBUF_WRITABLE 0x0001 - #define PyBUF_FORMAT 0x0004 - #define PyBUF_ND 0x0008 - #define PyBUF_STRIDES (0x0010 | PyBUF_ND) - #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) - #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) - #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) - #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) - #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) - #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) - typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); - typedef void (*releasebufferproc)(PyObject *, Py_buffer *); -#endif +#define __PYX_BUILD_PY_SSIZE_T "n" +#define CYTHON_FORMAT_SSIZE_T "z" #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ @@ -124,22 +70,11 @@ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) #define __Pyx_DefaultClassType PyType_Type #endif -#if PY_VERSION_HEX < 0x02060000 - #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") -#endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 -#endif -#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif -#if PY_VERSION_HEX < 0x02060000 - #define Py_TPFLAGS_HAVE_VERSION_TAG 0 -#endif -#if PY_VERSION_HEX < 0x02060000 && !defined(Py_TPFLAGS_IS_ABSTRACT) - #define Py_TPFLAGS_IS_ABSTRACT 0 -#endif #if PY_VERSION_HEX < 0x030400a1 && !defined(Py_TPFLAGS_HAVE_FINALIZE) #define Py_TPFLAGS_HAVE_FINALIZE 0 #endif @@ -164,12 +99,14 @@ #if CYTHON_COMPILING_IN_PYPY #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b) + #define __Pyx_PyFrozenSet_Size(s) PyObject_Size(s) #else #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b) #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ? \ PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b)) + #define __Pyx_PyFrozenSet_Size(s) PySet_Size(s) #endif -#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) +#define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b)) #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b)) #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b) @@ -183,36 +120,13 @@ #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif -#if PY_VERSION_HEX < 0x02060000 - #define PyBytesObject PyStringObject - #define PyBytes_Type PyString_Type - #define PyBytes_Check PyString_Check - #define PyBytes_CheckExact PyString_CheckExact - #define PyBytes_FromString PyString_FromString - #define PyBytes_FromStringAndSize PyString_FromStringAndSize - #define PyBytes_FromFormat PyString_FromFormat - #define PyBytes_DecodeEscape PyString_DecodeEscape - #define PyBytes_AsString PyString_AsString - #define PyBytes_AsStringAndSize PyString_AsStringAndSize - #define PyBytes_Size PyString_Size - #define PyBytes_AS_STRING PyString_AS_STRING - #define PyBytes_GET_SIZE PyString_GET_SIZE - #define PyBytes_Repr PyString_Repr - #define PyBytes_Concat PyString_Concat - #define PyBytes_ConcatAndDel PyString_ConcatAndDel -#endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) #else - #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ - PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj)) #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj)) #endif -#if PY_VERSION_HEX < 0x02060000 - #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) - #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) -#endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif @@ -237,6 +151,11 @@ #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif +#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY + #ifndef PyUnicode_InternFromString + #define PyUnicode_InternFromString(s) PyUnicode_FromString(s) + #endif +#endif #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong @@ -245,42 +164,10 @@ #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif -#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) - #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) - #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) -#else - #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) - #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) - #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ - (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ - (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ - (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) -#endif #if PY_MAJOR_VERSION >= 3 - #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) -#endif -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) -#else - #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) - #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) - #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) -#endif -#if PY_VERSION_HEX < 0x02050000 - #define __Pyx_NAMESTR(n) ((char *)(n)) - #define __Pyx_DOCSTR(n) ((char *)(n)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #else - #define __Pyx_NAMESTR(n) (n) - #define __Pyx_DOCSTR(n) (n) + #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif #ifndef CYTHON_INLINE #if defined(__GNUC__) @@ -387,7 +274,7 @@ void __Pyx_call_destructor(T* x) { # endif #endif typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; - const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 @@ -571,7 +458,7 @@ struct __pyx_opt_args_8pylibemu_8Emulator_test { PyObject *steps; }; -/* "pylibemu.pyx":613 +/* "pylibemu.pyx":614 * return 0 * * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< @@ -683,7 +570,7 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #ifdef WITH_THREAD #define __Pyx_RefNannySetupContext(name, acquire_gil) \ @@ -720,7 +607,7 @@ static struct __pyx_vtabstruct_8pylibemu_Emulator *__pyx_vtabptr_8pylibemu_Emula #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) -#endif /* CYTHON_REFNANNY */ +#endif #define __Pyx_XDECREF_SET(r, v) do { \ PyObject *tmp = (PyObject *) r; \ r = v; __Pyx_XDECREF(tmp); \ @@ -747,9 +634,9 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) #endif -static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ +static PyObject *__Pyx_GetBuiltinName(PyObject *name); -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); #include @@ -759,17 +646,29 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( PyObject* (*decode_func)(const char *s, Py_ssize_t size, const char *errors)); #if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); /*proto*/ +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); #else #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) #endif -static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg); +#endif + +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON && (PY_VERSION_HEX >= 0x03020000 || PY_MAJOR_VERSION < 3 && PY_VERSION_HEX >= 0x02070000) +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { PyObject *res; PyTypeObject *tp = Py_TYPE(obj); @@ -794,25 +693,25 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObj #define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); static void __Pyx_WriteUnraisable(const char *name, int clineno, int lineno, const char *filename, - int full_traceback); /*proto*/ + int full_traceback); -static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ - const char* function_name); /*proto*/ + const char* function_name); static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); -static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals); -static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); /*proto*/ +static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals); #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals @@ -820,20 +719,37 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals #endif -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname, - PyObject *mkw, PyObject *modname, PyObject *doc); /*proto*/ + PyObject *mkw, PyObject *modname, PyObject *doc); static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, - PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); /*proto*/ + PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); + +static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); -static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name); /*proto*/ +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); @@ -849,13 +765,13 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value); static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -static int __Pyx_Print(PyObject*, PyObject *, int); /*proto*/ +static int __Pyx_Print(PyObject*, PyObject *, int); #if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 static PyObject* __pyx_print = 0; static PyObject* __pyx_print_kwargs = 0; #endif -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); /*proto*/ +static int __Pyx_PrintOne(PyObject* stream, PyObject *o); static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *); @@ -879,29 +795,37 @@ static int __Pyx_check_binary_version(void); #endif #endif -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ - -typedef struct { - int code_line; - PyCodeObject* code_object; -} __Pyx_CodeObjectCacheEntry; -struct __Pyx_CodeObjectCache { - int count; - int max_count; - __Pyx_CodeObjectCacheEntry* entries; -}; -static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); -static PyCodeObject *__pyx_find_code_object(int code_line); -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); - -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - +static PyObject *__Pyx_ImportModule(const char *name); + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); + +static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_concatenate(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, char *__pyx_v_dst, char *__pyx_v_src, int __pyx_v_n); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_build_sep(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_function_header(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_function *__pyx_v_function); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_bracket_closed(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_start(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_array_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_start(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_log_struct_end(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_int(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_string(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_bytea(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ptr(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_is_struct, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_ip(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_port(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_render_none(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, CYTHON_UNUSED struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_none(CYTHON_UNUSED struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_int(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, int __pyx_v_value); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_render_ptr(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, void *__pyx_v_ptr); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_argument_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_argument *__pyx_v_argument, int __pyx_v_indent); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_function_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_profile_function *__pyx_v_function); /* proto*/ +static PyObject *__pyx_f_8pylibemu_10EmuProfile_emu_profile_debug(struct __pyx_obj_8pylibemu_EmuProfile *__pyx_v_self, struct emu_env *__pyx_v__env); /* proto*/ +static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, struct emu_env_hook *__pyx_v_hook); /* proto*/ +static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_test *__pyx_optional_args); /* proto*/ +static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, PyObject *__pyx_v_shellcode, int __pyx_skip_dispatch, struct __pyx_opt_args_8pylibemu_8Emulator_run *__pyx_optional_args); /* proto*/ /* Module declarations from 'libc.stdint' */ @@ -1464,8 +1388,10 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; - int __pyx_t_12; - int __pyx_t_13; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + int __pyx_t_14; + int __pyx_t_15; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1541,36 +1467,53 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * try: * url = urllib2.urlopen(szURL.decode('utf-8'), timeout = 10) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_szURL, 0, strlen(__pyx_v_szURL), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_szFileName, 0, strlen(__pyx_v_szFileName), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_decode_c_string(__pyx_v_szURL, 0, strlen(__pyx_v_szURL), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_decode_c_string(__pyx_v_szFileName, 0, strlen(__pyx_v_szFileName), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_1 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyString_Format(__pyx_kp_s_Downloading_s_s, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Downloading_s_s, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pylibemu.pyx":85 * @@ -1580,10 +1523,10 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * content = url.read() */ { - __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7); - __Pyx_XGOTREF(__pyx_t_5); + __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_7, &__pyx_t_8); __Pyx_XGOTREF(__pyx_t_6); __Pyx_XGOTREF(__pyx_t_7); + __Pyx_XGOTREF(__pyx_t_8); /*try:*/ { /* "pylibemu.pyx":86 @@ -1593,28 +1536,28 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * content = url.read() * except: */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_urllib2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_urlopen); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_decode_c_string(__pyx_v_szURL, 0, strlen(__pyx_v_szURL), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_urllib2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_urlopen); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_decode_c_string(__pyx_v_szURL, 0, strlen(__pyx_v_szURL), NULL, NULL, PyUnicode_DecodeUTF8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_timeout, __pyx_int_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_timeout, __pyx_int_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_url = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_url = __pyx_t_4; + __pyx_t_4 = 0; /* "pylibemu.pyx":87 * try: @@ -1625,21 +1568,37 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_url, __pyx_n_s_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + if (__pyx_t_2) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_content = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_content = __pyx_t_4; + __pyx_t_4 = 0; } - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L10_try_end; __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pylibemu.pyx":88 * url = urllib2.urlopen(szURL.decode('utf-8'), timeout = 10) @@ -1650,8 +1609,8 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env */ /*except:*/ { __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_3, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_1, &__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_GOTREF(__pyx_t_1); __Pyx_GOTREF(__pyx_t_2); @@ -1662,31 +1621,48 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * return 0x800C0008 # INET_E_DOWNLOAD_FAILURE * */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_downloading_from_s, __pyx_t_9); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_warning); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyBytes_FromString(__pyx_v_szURL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_downloading_from_s, __pyx_t_10); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) { + __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_9); + if (likely(__pyx_t_10)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9); + __Pyx_INCREF(__pyx_t_10); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_9, function); + } + } + if (!__pyx_t_10) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = NULL; + PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pylibemu.pyx":90 * except: @@ -1698,30 +1674,21 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env __pyx_r = 0x800C0008; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L6_except_return; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - goto __pyx_L4_exception_handled; } __pyx_L5_except_error:; - __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L1_error; __pyx_L6_except_return:; - __Pyx_XGIVEREF(__pyx_t_5); __Pyx_XGIVEREF(__pyx_t_6); __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_7, __pyx_t_8); goto __pyx_L0; - __pyx_L4_exception_handled:; - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_7); - __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_6, __pyx_t_7); __pyx_L10_try_end:; } @@ -1732,22 +1699,38 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * with open(str(m.hexdigest()), mode = 'wb') as fd: * fd.write(content) */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_hashlib); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_md5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_hashlib); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_content); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_content); - __Pyx_GIVEREF(__pyx_v_content); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_md5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_m = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_t_1 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_content); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = NULL; + __Pyx_INCREF(__pyx_v_content); + PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_content); + __Pyx_GIVEREF(__pyx_v_content); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_m = __pyx_t_2; + __pyx_t_2 = 0; /* "pylibemu.pyx":93 * @@ -1757,49 +1740,80 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env * */ /*with:*/ { - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_hexdigest); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_m, __pyx_n_s_hexdigest); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_mode, __pyx_n_s_wb) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_exit); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_2 = __Pyx_PyObject_LookupSpecial(__pyx_t_1, __pyx_n_s_enter); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L13_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_8 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_4 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_1)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_1); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_1) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L13_error;} + } + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /*try:*/ { { - __Pyx_ExceptionSave(&__pyx_t_6, &__pyx_t_5, &__pyx_t_10); + __Pyx_ExceptionSave(&__pyx_t_7, &__pyx_t_6, &__pyx_t_12); + __Pyx_XGOTREF(__pyx_t_7); __Pyx_XGOTREF(__pyx_t_6); - __Pyx_XGOTREF(__pyx_t_5); - __Pyx_XGOTREF(__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_12); /*try:*/ { - __Pyx_INCREF(__pyx_t_3); - __pyx_v_fd = __pyx_t_3; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_fd = __pyx_t_4; + __pyx_t_4 = 0; /* "pylibemu.pyx":94 * m = hashlib.md5(content) @@ -1810,28 +1824,46 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env */ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_fd, __pyx_n_s_write); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L17_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_v_content); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_content); - __Pyx_GIVEREF(__pyx_v_content); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_2) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_content); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_4); + } else { + __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = NULL; + __Pyx_INCREF(__pyx_v_content); + PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_content); + __Pyx_GIVEREF(__pyx_v_content); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L17_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L24_try_end; __pyx_L17_error:; - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; /* "pylibemu.pyx":93 * @@ -1842,66 +1874,66 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env */ /*except:*/ { __Pyx_AddTraceback("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_1, &__pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_Pack(3, __pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + if (__Pyx_GetException(&__pyx_t_4, &__pyx_t_3, &__pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_11 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_11); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (__pyx_t_12 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_t_13 = ((!(__pyx_t_12 != 0)) != 0); - if (__pyx_t_13) { - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ErrRestore(__pyx_t_2, __pyx_t_1, __pyx_t_3); - __pyx_t_2 = 0; __pyx_t_1 = 0; __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_Pack(3, __pyx_t_4, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_2, NULL); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_14 = __Pyx_PyObject_IsTrue(__pyx_t_13); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__pyx_t_14 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __pyx_t_15 = ((!(__pyx_t_14 != 0)) != 0); + if (__pyx_t_15) { + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_1); + __Pyx_ErrRestore(__pyx_t_4, __pyx_t_3, __pyx_t_1); + __pyx_t_4 = 0; __pyx_t_3 = 0; __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L18_exception_handled; } __pyx_L19_except_error:; + __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_12); goto __pyx_L1_error; __pyx_L18_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_7); __Pyx_XGIVEREF(__pyx_t_6); - __Pyx_XGIVEREF(__pyx_t_5); - __Pyx_XGIVEREF(__pyx_t_10); - __Pyx_ExceptionReset(__pyx_t_6, __pyx_t_5, __pyx_t_10); + __Pyx_XGIVEREF(__pyx_t_12); + __Pyx_ExceptionReset(__pyx_t_7, __pyx_t_6, __pyx_t_12); __pyx_L24_try_end:; } } /*finally:*/ { /*normal exit:*/{ - if (__pyx_t_7) { - __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_tuple_, NULL); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (__pyx_t_8) { + __pyx_t_12 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_tuple_, NULL); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } goto __pyx_L16; } __pyx_L16:; } - goto __pyx_L29; + goto __pyx_L28; __pyx_L13_error:; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; goto __pyx_L1_error; - __pyx_L29:; + __pyx_L28:; } /* "pylibemu.pyx":96 @@ -1928,8 +1960,10 @@ static uint32_t __pyx_f_8pylibemu_URLDownloadToFile(CYTHON_UNUSED struct emu_env __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); __Pyx_WriteUnraisable("pylibemu.URLDownloadToFile", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; __pyx_L0:; @@ -2119,9 +2153,8 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ __Pyx_RefNannyDeclarations int __pyx_t_1; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2134,14 +2167,16 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ * logging.warning("Memory allocation error") * sys._exit(-1) */ - __pyx_t_1 = ((__pyx_v_self->output == NULL) != 0); - if (!__pyx_t_1) { - __pyx_t_2 = ((__pyx_v_self->s == NULL) != 0); - __pyx_t_3 = __pyx_t_2; + __pyx_t_2 = ((__pyx_v_self->output == NULL) != 0); + if (!__pyx_t_2) { } else { - __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = __pyx_t_2; + goto __pyx_L4_bool_binop_done; } - if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_self->s == NULL) != 0); + __pyx_t_1 = __pyx_t_2; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { /* "pylibemu.pyx":126 * cdef check_memalloc(self): @@ -2150,15 +2185,15 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ * sys._exit(-1) * */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_warning); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_warning); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pylibemu.pyx":127 * if self.output is NULL or self.s is NULL: @@ -2167,15 +2202,15 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ * * cdef concatenate(self, char *dst, char *src, int n): */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_exit_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L3; } __pyx_L3:; @@ -2192,8 +2227,8 @@ static PyObject *__pyx_f_8pylibemu_10EmuProfile_check_memalloc(struct __pyx_obj_ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("pylibemu.EmuProfile.check_memalloc", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; @@ -4391,6 +4426,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emu int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4423,12 +4459,27 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emu * * def __dealloc__(self): */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (__pyx_t_5) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "pylibemu.pyx":437 * cdef bint enable_hooks @@ -4444,6 +4495,7 @@ static int __pyx_pf_8pylibemu_8Emulator___cinit__(struct __pyx_obj_8pylibemu_Emu __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("pylibemu.Emulator.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; @@ -4474,6 +4526,7 @@ static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4486,12 +4539,27 @@ static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu * * def free(self): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pylibemu.pyx":442 * self.new() @@ -4506,6 +4574,7 @@ static void __pyx_pf_8pylibemu_8Emulator_2__dealloc__(struct __pyx_obj_8pylibemu __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_WriteUnraisable("pylibemu.Emulator.__dealloc__", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -4695,7 +4764,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - size_t __pyx_t_3; + PyObject *__pyx_t_3 = NULL; + size_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4708,12 +4778,27 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ * self.output_size = output_size * self.new() */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_free); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pylibemu.pyx":456 * def set_output_size(self, output_size): @@ -4722,8 +4807,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ * self.new() * */ - __pyx_t_3 = __Pyx_PyInt_As_size_t(__pyx_v_output_size); if (unlikely((__pyx_t_3 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_self->output_size = __pyx_t_3; + __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_v_output_size); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->output_size = __pyx_t_4; /* "pylibemu.pyx":457 * self.free() @@ -4734,7 +4819,22 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ */ __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } else { + __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4753,6 +4853,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_8set_output_size(struct __pyx_obj_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("pylibemu.Emulator.set_output_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4791,8 +4892,9 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; - Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; + Py_ssize_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4815,12 +4917,27 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py * * buffer = shellcode */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; @@ -4832,8 +4949,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py * sclen = len(bytes(shellcode)) * */ - __pyx_t_4 = __Pyx_PyObject_AsString(__pyx_v_shellcode); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_buffer = ((char *)__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_shellcode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_buffer = ((char *)__pyx_t_5); /* "pylibemu.pyx":479 * @@ -4842,17 +4959,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py * * if buffer is NULL: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shellcode); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); - __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = PyBytes_GET_SIZE(__pyx_t_2); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)((PyObject*)(&PyBytes_Type))), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_sclen = __pyx_t_5; + __pyx_t_6 = PyBytes_GET_SIZE(__pyx_t_3); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_sclen = __pyx_t_6; /* "pylibemu.pyx":481 * sclen = len(bytes(shellcode)) @@ -4894,10 +5011,10 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py * def prepare(self, shellcode, offset): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; /* "pylibemu.pyx":459 @@ -4912,6 +5029,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_10shellcode_getpc_test(struct __py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("pylibemu.Emulator.shellcode_getpc_test", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5001,10 +5119,11 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - char *__pyx_t_5; - Py_ssize_t __pyx_t_6; - uint32_t __pyx_t_7; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + char *__pyx_t_6; + Py_ssize_t __pyx_t_7; + uint32_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5027,12 +5146,27 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_new); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; @@ -5062,8 +5196,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe * emu_cpu_reg32_set(_cpu, j, 0) * */ - for (__pyx_t_4 = 0; __pyx_t_4 < 8; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; + for (__pyx_t_5 = 0; __pyx_t_5 < 8; __pyx_t_5+=1) { + __pyx_v_j = __pyx_t_5; /* "pylibemu.pyx":511 * @@ -5181,8 +5315,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe * static_offset = 0x417000 * emu_memory_write_block(_mem, static_offset, scode, len(shellcode)) */ - __pyx_t_5 = __Pyx_PyObject_AsString(__pyx_v_shellcode); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_scode = ((char *)__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_v_shellcode); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_scode = ((char *)__pyx_t_6); /* "pylibemu.pyx":529 * # Write the code to the offset @@ -5200,8 +5334,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe * * # Set eip to the code */ - __pyx_t_6 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - emu_memory_write_block(__pyx_v__mem, __pyx_v_static_offset, __pyx_v_scode, __pyx_t_6); + __pyx_t_7 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 530; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + emu_memory_write_block(__pyx_v__mem, __pyx_v_static_offset, __pyx_v_scode, __pyx_t_7); /* "pylibemu.pyx":533 * @@ -5210,14 +5344,14 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe * * emu_memory_write_block(_mem, 0x0012fe98, scode, len(shellcode)) */ - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_static_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_static_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyInt_As_uint32_t(__pyx_t_2); if (unlikely((__pyx_t_7 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - emu_cpu_eip_set(emu_cpu_get(__pyx_v_self->_emu), __pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_t_3); if (unlikely((__pyx_t_8 == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + emu_cpu_eip_set(emu_cpu_get(__pyx_v_self->_emu), __pyx_t_8); /* "pylibemu.pyx":535 * emu_cpu_eip_set(emu_cpu_get(self._emu), static_offset + offset) @@ -5226,8 +5360,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe * emu_cpu_reg32_set(emu_cpu_get(self._emu), esp, 0x0012fe98) * */ - __pyx_t_6 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - emu_memory_write_block(__pyx_v__mem, 0x0012fe98, __pyx_v_scode, __pyx_t_6); + __pyx_t_7 = PyObject_Length(__pyx_v_shellcode); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + emu_memory_write_block(__pyx_v__mem, 0x0012fe98, __pyx_v_scode, __pyx_t_7); /* "pylibemu.pyx":536 * @@ -5252,6 +5386,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_12prepare(struct __pyx_obj_8pylibe __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("pylibemu.Emulator.prepare", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -5276,7 +5411,6 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; - int __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5296,21 +5430,23 @@ static PyObject *__pyx_f_8pylibemu_8Emulator_check_stop_emulation(CYTHON_UNUSED __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = __pyx_t_2; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_ExitProcess, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!__pyx_t_4) { - __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_ExitThread, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = __pyx_t_5; + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_ExitProcess, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_5) { } else { - __pyx_t_6 = __pyx_t_4; + __pyx_t_4 = __pyx_t_5; + goto __pyx_L3_bool_binop_done; } - if (!__pyx_t_6) { - __pyx_t_4 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_exit_3, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __pyx_t_4; + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_ExitThread, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!__pyx_t_5) { } else { - __pyx_t_5 = __pyx_t_6; + __pyx_t_4 = __pyx_t_5; + goto __pyx_L3_bool_binop_done; } + __pyx_t_5 = (__Pyx_PyString_Equals(__pyx_t_3, __pyx_n_s_exit_3, Py_EQ)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_t_5; + __pyx_L3_bool_binop_done:; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -5359,9 +5495,11 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - long __pyx_t_6; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + long __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5378,17 +5516,35 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_test); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pylibemu_8Emulator_15test)) { - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_steps); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_steps); - __Pyx_GIVEREF(__pyx_v_steps); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_4) { + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_steps); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + } else { + __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + __Pyx_INCREF(__pyx_v_steps); + PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_v_steps); + __Pyx_GIVEREF(__pyx_v_steps); + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } @@ -5402,8 +5558,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * return -1 * */ - __pyx_t_5 = ((__pyx_v_self->_emu == NULL) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_self->_emu == NULL) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":558 * @@ -5450,8 +5606,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * print emu_strerror(self._emu) * return -1 */ - __pyx_t_5 = ((__pyx_v__env == NULL) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v__env == NULL) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":564 * _env = emu_env_new(self._emu) @@ -5537,8 +5693,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * emu_env_w32_export_hook(_env, "ExitProcess", ExitProcess, NULL) * emu_env_w32_export_hook(_env, "ExitThread", ExitThread, NULL) */ - __pyx_t_5 = (__pyx_v_self->enable_hooks != 0); - if (__pyx_t_5) { + __pyx_t_7 = (__pyx_v_self->enable_hooks != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":578 * @@ -5595,9 +5751,9 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * if not _cpu.repeat_current_instr: * eipsave = emu_cpu_eip_get(emu_cpu_get(self._emu)) */ - __pyx_t_6 = __Pyx_PyInt_As_long(__pyx_v_steps); if (unlikely((__pyx_t_6 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_6; __pyx_t_4+=1) { - __pyx_v_j = __pyx_t_4; + __pyx_t_8 = __Pyx_PyInt_As_long(__pyx_v_steps); if (unlikely((__pyx_t_8 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_8; __pyx_t_6+=1) { + __pyx_v_j = __pyx_t_6; /* "pylibemu.pyx":586 * @@ -5606,8 +5762,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * eipsave = emu_cpu_eip_get(emu_cpu_get(self._emu)) * */ - __pyx_t_5 = ((!(__pyx_v__cpu->repeat_current_instr != 0)) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((!(__pyx_v__cpu->repeat_current_instr != 0)) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":587 * for j in range(steps): @@ -5637,8 +5793,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * if hook.hook.win.fnname is NULL: * logging.warning("Unhooked call to %s\n" % (hook.hook.win.fnname, )) */ - __pyx_t_5 = ((__pyx_v_hook != NULL) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_hook != NULL) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":591 * hook = emu_env_w32_eip_check(_env) @@ -5647,8 +5803,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * logging.warning("Unhooked call to %s\n" % (hook.hook.win.fnname, )) * break */ - __pyx_t_5 = ((__pyx_v_hook->hook.win->fnname == NULL) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_hook->hook.win->fnname == NULL) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":592 * if hook is not NULL: @@ -5657,30 +5813,47 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * break * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_hook->hook.win->fnname); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_Unhooked_call_to_s, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_hook->hook.win->fnname); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Unhooked_call_to_s, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + if (!__pyx_t_5) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; + PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "pylibemu.pyx":593 @@ -5702,9 +5875,9 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->check_stop_emulation(__pyx_v_self, __pyx_v_hook); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 595; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_5) { + if (__pyx_t_7) { /* "pylibemu.pyx":596 * @@ -5744,8 +5917,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * hook = emu_env_linux_syscall_check(_env) * if hook is NULL: */ - __pyx_t_5 = ((__pyx_v_ret != -1) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_ret != -1) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":601 * hook = NULL @@ -5763,8 +5936,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * ret = emu_cpu_step(emu_cpu_get(self._emu)) * else: */ - __pyx_t_5 = ((__pyx_v_hook == NULL) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_hook == NULL) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":603 * hook = emu_env_linux_syscall_check(_env) @@ -5787,12 +5960,12 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_logging); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_warning); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __pyx_L13:; @@ -5807,8 +5980,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * break * */ - __pyx_t_5 = ((__pyx_v_ret == -1) != 0); - if (__pyx_t_5) { + __pyx_t_7 = ((__pyx_v_ret == -1) != 0); + if (__pyx_t_7) { /* "pylibemu.pyx":608 * @@ -5828,8 +6001,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator * break * * self.emu_profile.emu_profile_debug(_env) # <<<<<<<<<<<<<< + * emu_env_free(_env) * return 0 - * */ __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_EmuProfile *)__pyx_v_self->emu_profile->__pyx_vtab)->emu_profile_debug(__pyx_v_self->emu_profile, __pyx_v__env); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 610; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -5838,6 +6011,15 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator /* "pylibemu.pyx":611 * * self.emu_profile.emu_profile_debug(_env) + * emu_env_free(_env) # <<<<<<<<<<<<<< + * return 0 + * + */ + emu_env_free(__pyx_v__env); + + /* "pylibemu.pyx":612 + * self.emu_profile.emu_profile_debug(_env) + * emu_env_free(_env) * return 0 # <<<<<<<<<<<<<< * * cpdef int run(self, shellcode, steps = 1000000): @@ -5858,6 +6040,8 @@ static int __pyx_f_8pylibemu_8Emulator_test(struct __pyx_obj_8pylibemu_Emulator __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_WriteUnraisable("pylibemu.Emulator.test", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; __pyx_L0:; @@ -5936,7 +6120,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_ __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.steps = __pyx_v_steps; - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->test(__pyx_v_self, 1, &__pyx_t_2); + __pyx_t_1 = __pyx_vtabptr_8pylibemu_Emulator->test(__pyx_v_self, 1, &__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; @@ -5954,7 +6138,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_14test(struct __pyx_obj_8pylibemu_ return __pyx_r; } -/* "pylibemu.pyx":613 +/* "pylibemu.pyx":614 * return 0 * * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< @@ -5971,10 +6155,13 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int32_t __pyx_t_5; - int __pyx_t_6; - struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_7; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + int32_t __pyx_t_8; + int __pyx_t_9; + struct __pyx_opt_args_8pylibemu_8Emulator_test __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5988,62 +6175,95 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8pylibemu_8Emulator_17run)) { - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; __pyx_t_4 = NULL; + __pyx_t_5 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_5 = 1; + } + } + __pyx_t_6 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (__pyx_t_4) { + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = NULL; + } __Pyx_INCREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_shellcode); + PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); __Pyx_INCREF(__pyx_v_steps); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_steps); + PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_steps); __Pyx_GIVEREF(__pyx_v_steps); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_7; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "pylibemu.pyx":616 + /* "pylibemu.pyx":617 * cdef int32_t offset * * offset = self.shellcode_getpc_test(shellcode) # <<<<<<<<<<<<<< * if offset < 0: * offset = 0 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shellcode_getpc_test); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_shellcode); - __Pyx_GIVEREF(__pyx_v_shellcode); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_shellcode_getpc_test); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyInt_As_int32_t(__pyx_t_2); if (unlikely((__pyx_t_5 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (!__pyx_t_3) { + __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_shellcode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + } else { + __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + __Pyx_INCREF(__pyx_v_shellcode); + PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_shellcode); + __Pyx_GIVEREF(__pyx_v_shellcode); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_offset = __pyx_t_5; + __pyx_t_8 = __Pyx_PyInt_As_int32_t(__pyx_t_1); if (unlikely((__pyx_t_8 == (int32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_offset = __pyx_t_8; - /* "pylibemu.pyx":617 + /* "pylibemu.pyx":618 * * offset = self.shellcode_getpc_test(shellcode) * if offset < 0: # <<<<<<<<<<<<<< * offset = 0 * */ - __pyx_t_6 = ((__pyx_v_offset < 0) != 0); - if (__pyx_t_6) { + __pyx_t_9 = ((__pyx_v_offset < 0) != 0); + if (__pyx_t_9) { - /* "pylibemu.pyx":618 + /* "pylibemu.pyx":619 * offset = self.shellcode_getpc_test(shellcode) * if offset < 0: * offset = 0 # <<<<<<<<<<<<<< @@ -6055,45 +6275,60 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * } __pyx_L3:; - /* "pylibemu.pyx":620 + /* "pylibemu.pyx":621 * offset = 0 * * self.prepare(shellcode, offset) # <<<<<<<<<<<<<< * return self.test(steps = steps) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prepare); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_prepare); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int32_t(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_PyInt_From_int32_t(__pyx_v_offset); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = NULL; + __pyx_t_5 = 0; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_5 = 1; + } + } + __pyx_t_4 = PyTuple_New(2+__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (__pyx_t_3) { + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = NULL; + } __Pyx_INCREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_shellcode); + PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_shellcode); __Pyx_GIVEREF(__pyx_v_shellcode); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":621 + /* "pylibemu.pyx":622 * * self.prepare(shellcode, offset) * return self.test(steps = steps) # <<<<<<<<<<<<<< * * @property */ - __pyx_t_7.__pyx_n = 1; - __pyx_t_7.steps = __pyx_v_steps; - __pyx_t_4 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->test(__pyx_v_self, 0, &__pyx_t_7); - __pyx_r = __pyx_t_4; + __pyx_t_10.__pyx_n = 1; + __pyx_t_10.steps = __pyx_v_steps; + __pyx_t_7 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->test(__pyx_v_self, 0, &__pyx_t_10); + __pyx_r = __pyx_t_7; goto __pyx_L0; - /* "pylibemu.pyx":613 + /* "pylibemu.pyx":614 * return 0 * * cpdef int run(self, shellcode, steps = 1000000): # <<<<<<<<<<<<<< @@ -6106,6 +6341,8 @@ static int __pyx_f_8pylibemu_8Emulator_run(struct __pyx_obj_8pylibemu_Emulator * __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); __Pyx_WriteUnraisable("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename, 0); __pyx_r = 0; __pyx_L0:; @@ -6149,7 +6386,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "run") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6164,7 +6401,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_17run(PyObject *__pyx_v_self, PyOb } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("run", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("run", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6190,8 +6427,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_16run(struct __pyx_obj_8pylibemu_E __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.steps = __pyx_v_steps; - __pyx_t_1 = ((struct __pyx_vtabstruct_8pylibemu_Emulator *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, __pyx_v_shellcode, 1, &__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_vtabptr_8pylibemu_Emulator->run(__pyx_v_self, __pyx_v_shellcode, 1, &__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -6208,7 +6445,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_16run(struct __pyx_obj_8pylibemu_E return __pyx_r; } -/* "pylibemu.pyx":624 +/* "pylibemu.pyx":625 * * @property * def offset(self): # <<<<<<<<<<<<<< @@ -6238,7 +6475,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18offset(struct __pyx_obj_8pylibem int __pyx_clineno = 0; __Pyx_RefNannySetupContext("offset", 0); - /* "pylibemu.pyx":625 + /* "pylibemu.pyx":626 * @property * def offset(self): * return self._offset # <<<<<<<<<<<<<< @@ -6246,13 +6483,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18offset(struct __pyx_obj_8pylibem * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_From_int32_t(__pyx_v_self->_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pylibemu.pyx":624 + /* "pylibemu.pyx":625 * * @property * def offset(self): # <<<<<<<<<<<<<< @@ -6271,7 +6508,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_18offset(struct __pyx_obj_8pylibem return __pyx_r; } -/* "pylibemu.pyx":628 +/* "pylibemu.pyx":629 * * @property * def emu_profile_output(self): # <<<<<<<<<<<<<< @@ -6301,7 +6538,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20emu_profile_output(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_output", 0); - /* "pylibemu.pyx":629 + /* "pylibemu.pyx":630 * @property * def emu_profile_output(self): * return self.emu_profile.output # <<<<<<<<<<<<<< @@ -6309,13 +6546,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20emu_profile_output(struct __pyx_ * @property */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->emu_profile->output); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_self->emu_profile->output); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pylibemu.pyx":628 + /* "pylibemu.pyx":629 * * @property * def emu_profile_output(self): # <<<<<<<<<<<<<< @@ -6334,7 +6571,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_20emu_profile_output(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":632 +/* "pylibemu.pyx":633 * * @property * def emu_profile_truncated(self): # <<<<<<<<<<<<<< @@ -6364,7 +6601,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22emu_profile_truncated(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("emu_profile_truncated", 0); - /* "pylibemu.pyx":633 + /* "pylibemu.pyx":634 * @property * def emu_profile_truncated(self): * return self.emu_profile.truncate # <<<<<<<<<<<<<< @@ -6372,13 +6609,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22emu_profile_truncated(struct __p * # CPU methods */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->emu_profile->truncate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->emu_profile->truncate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "pylibemu.pyx":632 + /* "pylibemu.pyx":633 * * @property * def emu_profile_truncated(self): # <<<<<<<<<<<<<< @@ -6397,7 +6634,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_22emu_profile_truncated(struct __p return __pyx_r; } -/* "pylibemu.pyx":636 +/* "pylibemu.pyx":637 * * # CPU methods * def cpu_reg32_get(self, c_emu_reg32 reg): # <<<<<<<<<<<<<< @@ -6417,7 +6654,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_25cpu_reg32_get(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_reg32_get (wrapper)", 0); assert(__pyx_arg_reg); { - __pyx_v_reg = ((enum emu_reg32)PyInt_AsLong(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reg = ((enum emu_reg32)PyInt_AsLong(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6443,7 +6680,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg32_get(struct __pyx_obj_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_reg32_get", 0); - /* "pylibemu.pyx":658 + /* "pylibemu.pyx":659 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6453,21 +6690,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg32_get(struct __pyx_obj_8 __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":659 + /* "pylibemu.pyx":660 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":661 + /* "pylibemu.pyx":662 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6476,7 +6713,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg32_get(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":662 + /* "pylibemu.pyx":663 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_reg32_get(_cpu, reg) # <<<<<<<<<<<<<< @@ -6484,13 +6721,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg32_get(struct __pyx_obj_8 * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_reg32_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_reg32_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 663; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":636 + /* "pylibemu.pyx":637 * * # CPU methods * def cpu_reg32_get(self, c_emu_reg32 reg): # <<<<<<<<<<<<<< @@ -6509,7 +6746,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_24cpu_reg32_get(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":664 +/* "pylibemu.pyx":665 * return emu_cpu_reg32_get(_cpu, reg) * * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): # <<<<<<<<<<<<<< @@ -6549,11 +6786,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set(PyObject *__pyx_v_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg32_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg32_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6561,12 +6798,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set(PyObject *__pyx_v_ values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_reg = ((enum emu_reg32)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_val = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_val == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reg = ((enum emu_reg32)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_val = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_val == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 664; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg32_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg32_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6590,7 +6827,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_reg32_set", 0); - /* "pylibemu.pyx":686 + /* "pylibemu.pyx":687 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6600,21 +6837,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8 __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":687 + /* "pylibemu.pyx":688 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":689 + /* "pylibemu.pyx":690 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6623,7 +6860,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":690 + /* "pylibemu.pyx":691 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg32_set(_cpu, reg, val) # <<<<<<<<<<<<<< @@ -6632,7 +6869,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8 */ emu_cpu_reg32_set(__pyx_v__cpu, __pyx_v_reg, __pyx_v_val); - /* "pylibemu.pyx":664 + /* "pylibemu.pyx":665 * return emu_cpu_reg32_get(_cpu, reg) * * def cpu_reg32_set(self, c_emu_reg32 reg, uint32_t val): # <<<<<<<<<<<<<< @@ -6653,7 +6890,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_26cpu_reg32_set(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":692 +/* "pylibemu.pyx":693 * emu_cpu_reg32_set(_cpu, reg, val) * * def cpu_reg16_get(self, c_emu_reg16 reg): # <<<<<<<<<<<<<< @@ -6673,7 +6910,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_29cpu_reg16_get(PyObject *__pyx_v_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_reg16_get (wrapper)", 0); assert(__pyx_arg_reg); { - __pyx_v_reg = ((enum emu_reg16)PyInt_AsLong(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 692; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reg = ((enum emu_reg16)PyInt_AsLong(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 693; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6699,7 +6936,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg16_get(struct __pyx_obj_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_reg16_get", 0); - /* "pylibemu.pyx":714 + /* "pylibemu.pyx":715 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6709,21 +6946,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg16_get(struct __pyx_obj_8 __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":715 + /* "pylibemu.pyx":716 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":717 + /* "pylibemu.pyx":718 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6732,7 +6969,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg16_get(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":718 + /* "pylibemu.pyx":719 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_reg16_get(_cpu, reg) # <<<<<<<<<<<<<< @@ -6740,13 +6977,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg16_get(struct __pyx_obj_8 * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint16_t(((uint16_t)emu_cpu_reg16_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(((uint16_t)emu_cpu_reg16_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":692 + /* "pylibemu.pyx":693 * emu_cpu_reg32_set(_cpu, reg, val) * * def cpu_reg16_get(self, c_emu_reg16 reg): # <<<<<<<<<<<<<< @@ -6765,7 +7002,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_28cpu_reg16_get(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":720 +/* "pylibemu.pyx":721 * return emu_cpu_reg16_get(_cpu, reg) * * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): # <<<<<<<<<<<<<< @@ -6805,11 +7042,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_31cpu_reg16_set(PyObject *__pyx_v_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg16_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg16_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6817,12 +7054,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_31cpu_reg16_set(PyObject *__pyx_v_ values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_reg = ((enum emu_reg16)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_val = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_val == (uint16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reg = ((enum emu_reg16)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_val = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_val == (uint16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 720; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg16_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg16_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6846,7 +7083,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_reg16_set(struct __pyx_obj_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_reg16_set", 0); - /* "pylibemu.pyx":742 + /* "pylibemu.pyx":743 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6856,21 +7093,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_reg16_set(struct __pyx_obj_8 __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":743 + /* "pylibemu.pyx":744 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":745 + /* "pylibemu.pyx":746 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6879,7 +7116,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_reg16_set(struct __pyx_obj_8 */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":746 + /* "pylibemu.pyx":747 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg16_set(_cpu, reg, val) # <<<<<<<<<<<<<< @@ -6888,7 +7125,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_reg16_set(struct __pyx_obj_8 */ emu_cpu_reg16_set(__pyx_v__cpu, __pyx_v_reg, __pyx_v_val); - /* "pylibemu.pyx":720 + /* "pylibemu.pyx":721 * return emu_cpu_reg16_get(_cpu, reg) * * def cpu_reg16_set(self, c_emu_reg16 reg, uint16_t val): # <<<<<<<<<<<<<< @@ -6909,7 +7146,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_30cpu_reg16_set(struct __pyx_obj_8 return __pyx_r; } -/* "pylibemu.pyx":748 +/* "pylibemu.pyx":749 * emu_cpu_reg16_set(_cpu, reg, val) * * def cpu_reg8_get(self, c_emu_reg8 reg): # <<<<<<<<<<<<<< @@ -6929,7 +7166,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_33cpu_reg8_get(PyObject *__pyx_v_s __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_reg8_get (wrapper)", 0); assert(__pyx_arg_reg); { - __pyx_v_reg = ((enum emu_reg8)PyInt_AsLong(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 748; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reg = ((enum emu_reg8)PyInt_AsLong(__pyx_arg_reg)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -6955,7 +7192,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_reg8_get(struct __pyx_obj_8p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_reg8_get", 0); - /* "pylibemu.pyx":770 + /* "pylibemu.pyx":771 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -6965,21 +7202,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_reg8_get(struct __pyx_obj_8p __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":771 + /* "pylibemu.pyx":772 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":773 + /* "pylibemu.pyx":774 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -6988,7 +7225,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_reg8_get(struct __pyx_obj_8p */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":774 + /* "pylibemu.pyx":775 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_reg8_get(_cpu, reg) # <<<<<<<<<<<<<< @@ -6996,13 +7233,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_reg8_get(struct __pyx_obj_8p * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint8_t(((uint8_t)emu_cpu_reg8_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(((uint8_t)emu_cpu_reg8_get(__pyx_v__cpu, __pyx_v_reg))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":748 + /* "pylibemu.pyx":749 * emu_cpu_reg16_set(_cpu, reg, val) * * def cpu_reg8_get(self, c_emu_reg8 reg): # <<<<<<<<<<<<<< @@ -7021,7 +7258,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_32cpu_reg8_get(struct __pyx_obj_8p return __pyx_r; } -/* "pylibemu.pyx":776 +/* "pylibemu.pyx":777 * return emu_cpu_reg8_get(_cpu, reg) * * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): # <<<<<<<<<<<<<< @@ -7061,11 +7298,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_35cpu_reg8_set(PyObject *__pyx_v_s case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_val)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg8_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "cpu_reg8_set") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -7073,12 +7310,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_35cpu_reg8_set(PyObject *__pyx_v_s values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_reg = ((enum emu_reg8)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_val = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_val == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reg = ((enum emu_reg8)PyInt_AsLong(values[0])); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_val = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_val == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("cpu_reg8_set", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.cpu_reg8_set", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7102,7 +7339,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_reg8_set(struct __pyx_obj_8p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_reg8_set", 0); - /* "pylibemu.pyx":798 + /* "pylibemu.pyx":799 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7112,21 +7349,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_reg8_set(struct __pyx_obj_8p __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":799 + /* "pylibemu.pyx":800 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":801 + /* "pylibemu.pyx":802 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7135,7 +7372,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_reg8_set(struct __pyx_obj_8p */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":802 + /* "pylibemu.pyx":803 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_reg8_set(_cpu, reg, val) # <<<<<<<<<<<<<< @@ -7144,7 +7381,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_reg8_set(struct __pyx_obj_8p */ emu_cpu_reg8_set(__pyx_v__cpu, __pyx_v_reg, __pyx_v_val); - /* "pylibemu.pyx":776 + /* "pylibemu.pyx":777 * return emu_cpu_reg8_get(_cpu, reg) * * def cpu_reg8_set(self, c_emu_reg8 reg, uint8_t val): # <<<<<<<<<<<<<< @@ -7165,7 +7402,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_34cpu_reg8_set(struct __pyx_obj_8p return __pyx_r; } -/* "pylibemu.pyx":804 +/* "pylibemu.pyx":805 * emu_cpu_reg8_set(_cpu, reg, val) * * def cpu_eflags_get(self): # <<<<<<<<<<<<<< @@ -7198,7 +7435,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eflags_get(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_eflags_get", 0); - /* "pylibemu.pyx":815 + /* "pylibemu.pyx":816 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7208,21 +7445,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eflags_get(struct __pyx_obj_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":816 + /* "pylibemu.pyx":817 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":818 + /* "pylibemu.pyx":819 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7231,7 +7468,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eflags_get(struct __pyx_obj_ */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":819 + /* "pylibemu.pyx":820 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_eflags_get(_cpu) # <<<<<<<<<<<<<< @@ -7239,13 +7476,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eflags_get(struct __pyx_obj_ * def cpu_eflags_set(self, uint32_t val): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eflags_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eflags_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":804 + /* "pylibemu.pyx":805 * emu_cpu_reg8_set(_cpu, reg, val) * * def cpu_eflags_get(self): # <<<<<<<<<<<<<< @@ -7264,7 +7501,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_36cpu_eflags_get(struct __pyx_obj_ return __pyx_r; } -/* "pylibemu.pyx":821 +/* "pylibemu.pyx":822 * return emu_cpu_eflags_get(_cpu) * * def cpu_eflags_set(self, uint32_t val): # <<<<<<<<<<<<<< @@ -7284,7 +7521,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_39cpu_eflags_set(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_eflags_set (wrapper)", 0); assert(__pyx_arg_val); { - __pyx_v_val = __Pyx_PyInt_As_uint32_t(__pyx_arg_val); if (unlikely((__pyx_v_val == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_val = __Pyx_PyInt_As_uint32_t(__pyx_arg_val); if (unlikely((__pyx_v_val == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7310,7 +7547,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_eflags_set(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_eflags_set", 0); - /* "pylibemu.pyx":832 + /* "pylibemu.pyx":833 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7320,21 +7557,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_eflags_set(struct __pyx_obj_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":833 + /* "pylibemu.pyx":834 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":835 + /* "pylibemu.pyx":836 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7343,7 +7580,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_eflags_set(struct __pyx_obj_ */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":836 + /* "pylibemu.pyx":837 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_eflags_set(_cpu, val) # <<<<<<<<<<<<<< @@ -7352,7 +7589,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_eflags_set(struct __pyx_obj_ */ emu_cpu_eflags_set(__pyx_v__cpu, __pyx_v_val); - /* "pylibemu.pyx":821 + /* "pylibemu.pyx":822 * return emu_cpu_eflags_get(_cpu) * * def cpu_eflags_set(self, uint32_t val): # <<<<<<<<<<<<<< @@ -7373,7 +7610,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_38cpu_eflags_set(struct __pyx_obj_ return __pyx_r; } -/* "pylibemu.pyx":838 +/* "pylibemu.pyx":839 * emu_cpu_eflags_set(_cpu, val) * * def cpu_eip_set(self, uint32_t eip): # <<<<<<<<<<<<<< @@ -7393,7 +7630,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_41cpu_eip_set(PyObject *__pyx_v_se __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_eip_set (wrapper)", 0); assert(__pyx_arg_eip); { - __pyx_v_eip = __Pyx_PyInt_As_uint32_t(__pyx_arg_eip); if (unlikely((__pyx_v_eip == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eip = __Pyx_PyInt_As_uint32_t(__pyx_arg_eip); if (unlikely((__pyx_v_eip == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7419,7 +7656,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_eip_set(struct __pyx_obj_8py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_eip_set", 0); - /* "pylibemu.pyx":849 + /* "pylibemu.pyx":850 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7429,21 +7666,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_eip_set(struct __pyx_obj_8py __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":850 + /* "pylibemu.pyx":851 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":852 + /* "pylibemu.pyx":853 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7452,7 +7689,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_eip_set(struct __pyx_obj_8py */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":853 + /* "pylibemu.pyx":854 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_eip_set(_cpu, eip) # <<<<<<<<<<<<<< @@ -7461,7 +7698,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_eip_set(struct __pyx_obj_8py */ emu_cpu_eip_set(__pyx_v__cpu, __pyx_v_eip); - /* "pylibemu.pyx":838 + /* "pylibemu.pyx":839 * emu_cpu_eflags_set(_cpu, val) * * def cpu_eip_set(self, uint32_t eip): # <<<<<<<<<<<<<< @@ -7482,7 +7719,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_40cpu_eip_set(struct __pyx_obj_8py return __pyx_r; } -/* "pylibemu.pyx":855 +/* "pylibemu.pyx":856 * emu_cpu_eip_set(_cpu, eip) * * def cpu_eip_get(self): # <<<<<<<<<<<<<< @@ -7515,7 +7752,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_eip_get(struct __pyx_obj_8py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_eip_get", 0); - /* "pylibemu.pyx":866 + /* "pylibemu.pyx":867 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7525,21 +7762,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_eip_get(struct __pyx_obj_8py __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":867 + /* "pylibemu.pyx":868 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":869 + /* "pylibemu.pyx":870 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7548,7 +7785,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_eip_get(struct __pyx_obj_8py */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":870 + /* "pylibemu.pyx":871 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_eip_get(_cpu) # <<<<<<<<<<<<<< @@ -7556,13 +7793,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_eip_get(struct __pyx_obj_8py * def cpu_parse(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eip_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(((uint32_t)emu_cpu_eip_get(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":855 + /* "pylibemu.pyx":856 * emu_cpu_eip_set(_cpu, eip) * * def cpu_eip_get(self): # <<<<<<<<<<<<<< @@ -7581,7 +7818,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_42cpu_eip_get(struct __pyx_obj_8py return __pyx_r; } -/* "pylibemu.pyx":872 +/* "pylibemu.pyx":873 * return emu_cpu_eip_get(_cpu) * * def cpu_parse(self): # <<<<<<<<<<<<<< @@ -7614,7 +7851,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_parse(struct __pyx_obj_8pyli int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_parse", 0); - /* "pylibemu.pyx":880 + /* "pylibemu.pyx":881 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7624,21 +7861,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_parse(struct __pyx_obj_8pyli __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":881 + /* "pylibemu.pyx":882 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":883 + /* "pylibemu.pyx":884 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7647,7 +7884,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_parse(struct __pyx_obj_8pyli */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":884 + /* "pylibemu.pyx":885 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_parse(_cpu) # <<<<<<<<<<<<<< @@ -7655,13 +7892,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_parse(struct __pyx_obj_8pyli * def cpu_step(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_parse(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 884; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_parse(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 885; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":872 + /* "pylibemu.pyx":873 * return emu_cpu_eip_get(_cpu) * * def cpu_parse(self): # <<<<<<<<<<<<<< @@ -7680,7 +7917,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_44cpu_parse(struct __pyx_obj_8pyli return __pyx_r; } -/* "pylibemu.pyx":886 +/* "pylibemu.pyx":887 * return emu_cpu_parse(_cpu) * * def cpu_step(self): # <<<<<<<<<<<<<< @@ -7713,7 +7950,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_step(struct __pyx_obj_8pylib int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_step", 0); - /* "pylibemu.pyx":894 + /* "pylibemu.pyx":895 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7723,21 +7960,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_step(struct __pyx_obj_8pylib __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":895 + /* "pylibemu.pyx":896 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":897 + /* "pylibemu.pyx":898 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7746,7 +7983,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_step(struct __pyx_obj_8pylib */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":898 + /* "pylibemu.pyx":899 * * _cpu = emu_cpu_get(self._emu) * return emu_cpu_step(_cpu) # <<<<<<<<<<<<<< @@ -7754,13 +7991,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_step(struct __pyx_obj_8pylib * def cpu_debugflag_set(self, uint8_t flag): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_step(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_int32_t(((int32_t)emu_cpu_step(__pyx_v__cpu))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":886 + /* "pylibemu.pyx":887 * return emu_cpu_parse(_cpu) * * def cpu_step(self): # <<<<<<<<<<<<<< @@ -7779,7 +8016,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_46cpu_step(struct __pyx_obj_8pylib return __pyx_r; } -/* "pylibemu.pyx":900 +/* "pylibemu.pyx":901 * return emu_cpu_step(_cpu) * * def cpu_debugflag_set(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -7799,7 +8036,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_49cpu_debugflag_set(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_debugflag_set (wrapper)", 0); assert(__pyx_arg_flag); { - __pyx_v_flag = __Pyx_PyInt_As_uint8_t(__pyx_arg_flag); if (unlikely((__pyx_v_flag == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_flag = __Pyx_PyInt_As_uint8_t(__pyx_arg_flag); if (unlikely((__pyx_v_flag == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7825,7 +8062,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48cpu_debugflag_set(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_debugflag_set", 0); - /* "pylibemu.pyx":911 + /* "pylibemu.pyx":912 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7835,21 +8072,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48cpu_debugflag_set(struct __pyx_o __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":912 + /* "pylibemu.pyx":913 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":914 + /* "pylibemu.pyx":915 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7858,7 +8095,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48cpu_debugflag_set(struct __pyx_o */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":915 + /* "pylibemu.pyx":916 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_debugflag_set(_cpu, flag) # <<<<<<<<<<<<<< @@ -7867,7 +8104,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48cpu_debugflag_set(struct __pyx_o */ emu_cpu_debugflag_set(__pyx_v__cpu, __pyx_v_flag); - /* "pylibemu.pyx":900 + /* "pylibemu.pyx":901 * return emu_cpu_step(_cpu) * * def cpu_debugflag_set(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -7888,7 +8125,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_48cpu_debugflag_set(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":917 +/* "pylibemu.pyx":918 * emu_cpu_debugflag_set(_cpu, flag) * * def cpu_debugflag_unset(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -7908,7 +8145,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_51cpu_debugflag_unset(PyObject *__ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("cpu_debugflag_unset (wrapper)", 0); assert(__pyx_arg_flag); { - __pyx_v_flag = __Pyx_PyInt_As_uint8_t(__pyx_arg_flag); if (unlikely((__pyx_v_flag == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 917; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_flag = __Pyx_PyInt_As_uint8_t(__pyx_arg_flag); if (unlikely((__pyx_v_flag == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 918; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7934,7 +8171,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50cpu_debugflag_unset(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_debugflag_unset", 0); - /* "pylibemu.pyx":928 + /* "pylibemu.pyx":929 * cdef c_emu_cpu *_cpu * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -7944,21 +8181,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50cpu_debugflag_unset(struct __pyx __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":929 + /* "pylibemu.pyx":930 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":931 + /* "pylibemu.pyx":932 * raise RuntimeError('Emulator not initialized') * * _cpu = emu_cpu_get(self._emu) # <<<<<<<<<<<<<< @@ -7967,7 +8204,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50cpu_debugflag_unset(struct __pyx */ __pyx_v__cpu = emu_cpu_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":932 + /* "pylibemu.pyx":933 * * _cpu = emu_cpu_get(self._emu) * emu_cpu_debugflag_unset(_cpu, flag) # <<<<<<<<<<<<<< @@ -7976,7 +8213,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50cpu_debugflag_unset(struct __pyx */ emu_cpu_debugflag_unset(__pyx_v__cpu, __pyx_v_flag); - /* "pylibemu.pyx":917 + /* "pylibemu.pyx":918 * emu_cpu_debugflag_set(_cpu, flag) * * def cpu_debugflag_unset(self, uint8_t flag): # <<<<<<<<<<<<<< @@ -7997,7 +8234,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_50cpu_debugflag_unset(struct __pyx return __pyx_r; } -/* "pylibemu.pyx":934 +/* "pylibemu.pyx":935 * emu_cpu_debugflag_unset(_cpu, flag) * * def cpu_get_current_instruction(self): # <<<<<<<<<<<<<< @@ -8026,13 +8263,14 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52cpu_get_current_instruction(stru int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - char *__pyx_t_4; + PyObject *__pyx_t_4 = NULL; + char *__pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cpu_get_current_instruction", 0); - /* "pylibemu.pyx":943 + /* "pylibemu.pyx":944 * Raises RuntimeError if the Emulator is not initialized * ''' * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8042,73 +8280,88 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52cpu_get_current_instruction(stru __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":944 + /* "pylibemu.pyx":945 * ''' * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * self.cpu_debugflag_set(1) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":946 + /* "pylibemu.pyx":947 * raise RuntimeError('Emulator not initialized') * * self.cpu_debugflag_set(1) # <<<<<<<<<<<<<< * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_set); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_set); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":947 + /* "pylibemu.pyx":948 * * self.cpu_debugflag_set(1) * self.cpu_parse() # <<<<<<<<<<<<<< * instr_string = emu_cpu_get(self._emu).instr_string * self.cpu_debugflag_unset(1) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_parse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_parse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + if (__pyx_t_4) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else { + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 948; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "pylibemu.pyx":948 + /* "pylibemu.pyx":949 * self.cpu_debugflag_set(1) * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string # <<<<<<<<<<<<<< * self.cpu_debugflag_unset(1) * */ - __pyx_t_4 = emu_cpu_get(__pyx_v_self->_emu)->instr_string; - __pyx_v_instr_string = __pyx_t_4; + __pyx_t_5 = emu_cpu_get(__pyx_v_self->_emu)->instr_string; + __pyx_v_instr_string = __pyx_t_5; - /* "pylibemu.pyx":949 + /* "pylibemu.pyx":950 * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string * self.cpu_debugflag_unset(1) # <<<<<<<<<<<<<< * * return instr_string */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_unset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_cpu_debugflag_unset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":951 + /* "pylibemu.pyx":952 * self.cpu_debugflag_unset(1) * * return instr_string # <<<<<<<<<<<<<< @@ -8116,13 +8369,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52cpu_get_current_instruction(stru * # Memory methods */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBytes_FromString(__pyx_v_instr_string); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 951; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; - goto __pyx_L0; - - /* "pylibemu.pyx":934 + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_instr_string); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 952; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "pylibemu.pyx":935 * emu_cpu_debugflag_unset(_cpu, flag) * * def cpu_get_current_instruction(self): # <<<<<<<<<<<<<< @@ -8134,6 +8387,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52cpu_get_current_instruction(stru __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("pylibemu.Emulator.cpu_get_current_instruction", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -8142,7 +8396,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_52cpu_get_current_instruction(stru return __pyx_r; } -/* "pylibemu.pyx":954 +/* "pylibemu.pyx":955 * * # Memory methods * def memory_write_byte(self, uint32_t addr, uint8_t byte): # <<<<<<<<<<<<<< @@ -8182,11 +8436,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_byte(PyObject *__py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_byte)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_byte") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_byte") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8194,12 +8448,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_55memory_write_byte(PyObject *__py values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_byte = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_byte == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_byte = __Pyx_PyInt_As_uint8_t(values[1]); if (unlikely((__pyx_v_byte == (uint8_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 954; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_byte", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 955; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_write_byte", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8223,7 +8477,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_byte(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_write_byte", 0); - /* "pylibemu.pyx":968 + /* "pylibemu.pyx":969 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8233,21 +8487,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_byte(struct __pyx_o __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":969 + /* "pylibemu.pyx":970 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":971 + /* "pylibemu.pyx":972 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -8256,7 +8510,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_byte(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":972 + /* "pylibemu.pyx":973 * * _mem = emu_memory_get(self._emu) * emu_memory_write_byte(_mem, addr, byte) # <<<<<<<<<<<<<< @@ -8265,7 +8519,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_byte(struct __pyx_o */ emu_memory_write_byte(__pyx_v__mem, __pyx_v_addr, __pyx_v_byte); - /* "pylibemu.pyx":954 + /* "pylibemu.pyx":955 * * # Memory methods * def memory_write_byte(self, uint32_t addr, uint8_t byte): # <<<<<<<<<<<<<< @@ -8286,7 +8540,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_54memory_write_byte(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":974 +/* "pylibemu.pyx":975 * emu_memory_write_byte(_mem, addr, byte) * * def memory_write_word(self, uint32_t addr, uint16_t word): # <<<<<<<<<<<<<< @@ -8326,11 +8580,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_57memory_write_word(PyObject *__py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_word)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_word") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_word") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8338,12 +8592,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_57memory_write_word(PyObject *__py values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_word = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_word == (uint16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_word = __Pyx_PyInt_As_uint16_t(values[1]); if (unlikely((__pyx_v_word == (uint16_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 974; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_word", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 975; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_write_word", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8367,7 +8621,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_write_word(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_write_word", 0); - /* "pylibemu.pyx":988 + /* "pylibemu.pyx":989 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8377,21 +8631,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_write_word(struct __pyx_o __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":989 + /* "pylibemu.pyx":990 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":991 + /* "pylibemu.pyx":992 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -8400,7 +8654,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_write_word(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":992 + /* "pylibemu.pyx":993 * * _mem = emu_memory_get(self._emu) * emu_memory_write_word(_mem, addr, word) # <<<<<<<<<<<<<< @@ -8409,7 +8663,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_write_word(struct __pyx_o */ emu_memory_write_word(__pyx_v__mem, __pyx_v_addr, __pyx_v_word); - /* "pylibemu.pyx":974 + /* "pylibemu.pyx":975 * emu_memory_write_byte(_mem, addr, byte) * * def memory_write_word(self, uint32_t addr, uint16_t word): # <<<<<<<<<<<<<< @@ -8430,7 +8684,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_56memory_write_word(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":994 +/* "pylibemu.pyx":995 * emu_memory_write_word(_mem, addr, word) * * def memory_write_dword(self, uint32_t addr, uint32_t dword): # <<<<<<<<<<<<<< @@ -8470,11 +8724,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_59memory_write_dword(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dword)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_dword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_dword") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8482,12 +8736,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_59memory_write_dword(PyObject *__p values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_dword = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_dword == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_dword = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_dword == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 994; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_dword", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 995; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_write_dword", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8511,7 +8765,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_write_dword(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_write_dword", 0); - /* "pylibemu.pyx":1008 + /* "pylibemu.pyx":1009 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8521,21 +8775,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_write_dword(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1009 + /* "pylibemu.pyx":1010 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__28, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1011 + /* "pylibemu.pyx":1012 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -8544,7 +8798,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_write_dword(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1012 + /* "pylibemu.pyx":1013 * * _mem = emu_memory_get(self._emu) * emu_memory_write_dword(_mem, addr, dword) # <<<<<<<<<<<<<< @@ -8553,7 +8807,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_write_dword(struct __pyx_ */ emu_memory_write_dword(__pyx_v__mem, __pyx_v_addr, __pyx_v_dword); - /* "pylibemu.pyx":994 + /* "pylibemu.pyx":995 * emu_memory_write_word(_mem, addr, word) * * def memory_write_dword(self, uint32_t addr, uint32_t dword): # <<<<<<<<<<<<<< @@ -8574,7 +8828,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_58memory_write_dword(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1014 +/* "pylibemu.pyx":1015 * emu_memory_write_dword(_mem, addr, dword) * * def memory_write_block(self, uint32_t addr, src, size_t _len): # <<<<<<<<<<<<<< @@ -8616,16 +8870,16 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_61memory_write_block(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_src)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_len)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_write_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -8634,13 +8888,13 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_61memory_write_block(PyObject *__p values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_src = values[1]; - __pyx_v__len = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v__len = __Pyx_PyInt_As_size_t(values[2]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1014; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_write_block", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1015; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_write_block", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -8664,7 +8918,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_write_block(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_write_block", 0); - /* "pylibemu.pyx":1031 + /* "pylibemu.pyx":1032 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8674,21 +8928,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_write_block(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1032 + /* "pylibemu.pyx":1033 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__29, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1034 + /* "pylibemu.pyx":1035 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -8697,7 +8951,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_write_block(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1035 + /* "pylibemu.pyx":1036 * * _mem = emu_memory_get(self._emu) * emu_memory_write_block(_mem, addr, src, _len) # <<<<<<<<<<<<<< @@ -8706,7 +8960,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_write_block(struct __pyx_ */ emu_memory_write_block(__pyx_v__mem, __pyx_v_addr, ((void *)__pyx_v_src), __pyx_v__len); - /* "pylibemu.pyx":1014 + /* "pylibemu.pyx":1015 * emu_memory_write_dword(_mem, addr, dword) * * def memory_write_block(self, uint32_t addr, src, size_t _len): # <<<<<<<<<<<<<< @@ -8727,7 +8981,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_60memory_write_block(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1037 +/* "pylibemu.pyx":1038 * emu_memory_write_block(_mem, addr, src, _len) * * def memory_read_byte(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -8747,7 +9001,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_63memory_read_byte(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("memory_read_byte (wrapper)", 0); assert(__pyx_arg_addr); { - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1037; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1038; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8775,7 +9029,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_byte(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_read_byte", 0); - /* "pylibemu.pyx":1052 + /* "pylibemu.pyx":1053 * cdef uint8_t byte * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8785,21 +9039,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_byte(struct __pyx_ob __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1053 + /* "pylibemu.pyx":1054 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__30, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1055 + /* "pylibemu.pyx":1056 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -8808,7 +9062,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_byte(struct __pyx_ob */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1056 + /* "pylibemu.pyx":1057 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_byte(_mem, addr, &byte): # <<<<<<<<<<<<<< @@ -8818,37 +9072,37 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_byte(struct __pyx_ob __pyx_t_1 = (emu_memory_read_byte(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_byte)) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1057 + /* "pylibemu.pyx":1058 * _mem = emu_memory_get(self._emu) * if emu_memory_read_byte(_mem, addr, &byte): * raise RuntimeError("Error while reading a byte at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return byte */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_byte_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_byte_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1059 + /* "pylibemu.pyx":1060 * raise RuntimeError("Error while reading a byte at address 0x%x" % (addr, )) * * return byte # <<<<<<<<<<<<<< @@ -8856,13 +9110,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_byte(struct __pyx_ob * def memory_read_word(self, uint32_t addr): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_byte); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1059; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint8_t(__pyx_v_byte); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1037 + /* "pylibemu.pyx":1038 * emu_memory_write_block(_mem, addr, src, _len) * * def memory_read_byte(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -8882,7 +9136,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_62memory_read_byte(struct __pyx_ob return __pyx_r; } -/* "pylibemu.pyx":1061 +/* "pylibemu.pyx":1062 * return byte * * def memory_read_word(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -8902,7 +9156,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_65memory_read_word(PyObject *__pyx __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("memory_read_word (wrapper)", 0); assert(__pyx_arg_addr); { - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -8930,7 +9184,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_word(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_read_word", 0); - /* "pylibemu.pyx":1076 + /* "pylibemu.pyx":1077 * cdef uint16_t word * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -8940,21 +9194,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_word(struct __pyx_ob __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1077 + /* "pylibemu.pyx":1078 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__31, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1079 + /* "pylibemu.pyx":1080 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -8963,7 +9217,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_word(struct __pyx_ob */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1080 + /* "pylibemu.pyx":1081 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_word(_mem, addr, &word): # <<<<<<<<<<<<<< @@ -8973,37 +9227,37 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_word(struct __pyx_ob __pyx_t_1 = (emu_memory_read_word(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_word)) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1081 + /* "pylibemu.pyx":1082 * _mem = emu_memory_get(self._emu) * if emu_memory_read_word(_mem, addr, &word): * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return word */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1082; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1083 + /* "pylibemu.pyx":1084 * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) * * return word # <<<<<<<<<<<<<< @@ -9011,13 +9265,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_word(struct __pyx_ob * def memory_read_dword(self, uint32_t addr): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint16_t(__pyx_v_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1083; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint16_t(__pyx_v_word); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1061 + /* "pylibemu.pyx":1062 * return byte * * def memory_read_word(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -9037,7 +9291,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_64memory_read_word(struct __pyx_ob return __pyx_r; } -/* "pylibemu.pyx":1085 +/* "pylibemu.pyx":1086 * return word * * def memory_read_dword(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -9057,7 +9311,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_67memory_read_dword(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("memory_read_dword (wrapper)", 0); assert(__pyx_arg_addr); { - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1085; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(__pyx_arg_addr); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1086; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9085,7 +9339,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_read_dword(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_read_dword", 0); - /* "pylibemu.pyx":1100 + /* "pylibemu.pyx":1101 * cdef uint32_t dword * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9095,21 +9349,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_read_dword(struct __pyx_o __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1101 + /* "pylibemu.pyx":1102 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__32, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1103 + /* "pylibemu.pyx":1104 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9118,7 +9372,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_read_dword(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1104 + /* "pylibemu.pyx":1105 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_dword(_mem, addr, &dword): # <<<<<<<<<<<<<< @@ -9128,37 +9382,37 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_read_dword(struct __pyx_o __pyx_t_1 = (emu_memory_read_dword(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_dword)) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1105 + /* "pylibemu.pyx":1106 * _mem = emu_memory_get(self._emu) * if emu_memory_read_dword(_mem, addr, &dword): * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return dword */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_word_at_ad, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1107 + /* "pylibemu.pyx":1108 * raise RuntimeError("Error while reading a word at address 0x%x" % (addr, )) * * return dword # <<<<<<<<<<<<<< @@ -9166,13 +9420,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_read_dword(struct __pyx_o * def memory_read_block(self, uint32_t addr, size_t _len): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_dword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_dword); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1085 + /* "pylibemu.pyx":1086 * return word * * def memory_read_dword(self, uint32_t addr): # <<<<<<<<<<<<<< @@ -9192,7 +9446,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_66memory_read_dword(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":1109 +/* "pylibemu.pyx":1110 * return dword * * def memory_read_block(self, uint32_t addr, size_t _len): # <<<<<<<<<<<<<< @@ -9232,11 +9486,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_read_block(PyObject *__py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_len)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_block") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -9244,12 +9498,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_read_block(PyObject *__py values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v__len = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v__len = __Pyx_PyInt_As_size_t(values[1]); if (unlikely((__pyx_v__len == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_read_block", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1110; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_read_block", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -9275,7 +9529,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_read_block", 0); - /* "pylibemu.pyx":1127 + /* "pylibemu.pyx":1128 * cdef void *block * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9285,21 +9539,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1128 + /* "pylibemu.pyx":1129 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * block = malloc(_len) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__33, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1130 + /* "pylibemu.pyx":1131 * raise RuntimeError('Emulator not initialized') * * block = malloc(_len) # <<<<<<<<<<<<<< @@ -9308,7 +9562,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o */ __pyx_v_block = malloc(__pyx_v__len); - /* "pylibemu.pyx":1131 + /* "pylibemu.pyx":1132 * * block = malloc(_len) * if block is NULL: # <<<<<<<<<<<<<< @@ -9318,21 +9572,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o __pyx_t_1 = ((__pyx_v_block == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1132 + /* "pylibemu.pyx":1133 * block = malloc(_len) * if block is NULL: * raise RuntimeError('Error while allocating memory') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__34, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1134 + /* "pylibemu.pyx":1135 * raise RuntimeError('Error while allocating memory') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9341,7 +9595,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1135 + /* "pylibemu.pyx":1136 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_block(_mem, addr, block, _len): # <<<<<<<<<<<<<< @@ -9351,37 +9605,37 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o __pyx_t_1 = (emu_memory_read_block(__pyx_v__mem, __pyx_v_addr, __pyx_v_block, __pyx_v__len) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1136 + /* "pylibemu.pyx":1137 * _mem = emu_memory_get(self._emu) * if emu_memory_read_block(_mem, addr, block, _len): * raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return block */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_dword_at_a, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_dword_at_a, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1138 + /* "pylibemu.pyx":1139 * raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) * * return block # <<<<<<<<<<<<<< @@ -9389,13 +9643,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o * def memory_read_string(self, uint32_t addr, uint32_t maxsize): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_block)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_block)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1109 + /* "pylibemu.pyx":1110 * return dword * * def memory_read_block(self, uint32_t addr, size_t _len): # <<<<<<<<<<<<<< @@ -9415,7 +9669,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":1140 +/* "pylibemu.pyx":1141 * return block * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< @@ -9455,11 +9709,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_71memory_read_string(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_maxsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_string") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_string") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -9467,12 +9721,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_71memory_read_string(PyObject *__p values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_maxsize = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_maxsize == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_maxsize = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_maxsize == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_read_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -9498,7 +9752,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_read_string", 0); - /* "pylibemu.pyx":1158 + /* "pylibemu.pyx":1159 * cdef c_emu_string s * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9508,21 +9762,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1159 + /* "pylibemu.pyx":1160 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1161 + /* "pylibemu.pyx":1162 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9531,7 +9785,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1162 + /* "pylibemu.pyx":1163 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): # <<<<<<<<<<<<<< @@ -9541,37 +9795,37 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ __pyx_t_1 = (emu_memory_read_string(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_s), __pyx_v_maxsize) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1163 + /* "pylibemu.pyx":1164 * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * * return s.data */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_string_at, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_string_at, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1165 + /* "pylibemu.pyx":1166 * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) * * return s.data # <<<<<<<<<<<<<< @@ -9579,13 +9833,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ * def memory_segment_select(self, c_emu_segment segment): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_s.data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_s.data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1140 + /* "pylibemu.pyx":1141 * return block * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< @@ -9605,7 +9859,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1167 +/* "pylibemu.pyx":1168 * return s.data * * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< @@ -9625,7 +9879,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_73memory_segment_select(PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("memory_segment_select (wrapper)", 0); assert(__pyx_arg_segment); { - __pyx_v_segment = ((enum emu_segment)PyInt_AsLong(__pyx_arg_segment)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1167; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_segment = ((enum emu_segment)PyInt_AsLong(__pyx_arg_segment)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9651,7 +9905,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_segment_select", 0); - /* "pylibemu.pyx":1184 + /* "pylibemu.pyx":1185 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9661,21 +9915,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1185 + /* "pylibemu.pyx":1186 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1187 + /* "pylibemu.pyx":1188 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9684,7 +9938,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1188 + /* "pylibemu.pyx":1189 * * _mem = emu_memory_get(self._emu) * emu_memory_segment_select(_mem, segment) # <<<<<<<<<<<<<< @@ -9693,7 +9947,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p */ emu_memory_segment_select(__pyx_v__mem, __pyx_v_segment); - /* "pylibemu.pyx":1167 + /* "pylibemu.pyx":1168 * return s.data * * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< @@ -9714,7 +9968,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p return __pyx_r; } -/* "pylibemu.pyx":1190 +/* "pylibemu.pyx":1191 * emu_memory_segment_select(_mem, segment) * * def memory_segment_get(self): # <<<<<<<<<<<<<< @@ -9747,7 +10001,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_segment_get", 0); - /* "pylibemu.pyx":1207 + /* "pylibemu.pyx":1208 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9757,21 +10011,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1208 + /* "pylibemu.pyx":1209 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1210 + /* "pylibemu.pyx":1211 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9780,7 +10034,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1211 + /* "pylibemu.pyx":1212 * * _mem = emu_memory_get(self._emu) * return emu_memory_segment_get(_mem) # <<<<<<<<<<<<<< @@ -9788,13 +10042,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ * # Win32 environment */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(emu_memory_segment_get(__pyx_v__mem)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(emu_memory_segment_get(__pyx_v__mem)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1190 + /* "pylibemu.pyx":1191 * emu_memory_segment_select(_mem, segment) * * def memory_segment_get(self): # <<<<<<<<<<<<<< @@ -9813,7 +10067,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1214 +/* "pylibemu.pyx":1215 * * # Win32 environment * def env_w32_hook_check(self): # <<<<<<<<<<<<<< @@ -9846,7 +10100,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("env_w32_hook_check", 0); - /* "pylibemu.pyx":1227 + /* "pylibemu.pyx":1228 * cdef c_emu_env *_env * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9856,21 +10110,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1228 + /* "pylibemu.pyx":1229 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _env = emu_env_new(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1230 + /* "pylibemu.pyx":1231 * raise RuntimeError('Emulator not initialized') * * _env = emu_env_new(self._emu) # <<<<<<<<<<<<<< @@ -9879,7 +10133,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ */ __pyx_v__env = emu_env_new(__pyx_v_self->_emu); - /* "pylibemu.pyx":1231 + /* "pylibemu.pyx":1232 * * _env = emu_env_new(self._emu) * if _env is NULL: # <<<<<<<<<<<<<< @@ -9889,48 +10143,57 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ __pyx_t_1 = ((__pyx_v__env == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1232 + /* "pylibemu.pyx":1233 * _env = emu_env_new(self._emu) * if _env is NULL: * print emu_strerror(self._emu) # <<<<<<<<<<<<<< * raise RuntimeError('Emulator environment error') * */ - __pyx_t_2 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PrintOne(0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PrintOne(0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":1233 + /* "pylibemu.pyx":1234 * if _env is NULL: * print emu_strerror(self._emu) * raise RuntimeError('Emulator environment error') # <<<<<<<<<<<<<< * * if emu_env_w32_eip_check(_env) is NULL: */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1235 + /* "pylibemu.pyx":1236 * raise RuntimeError('Emulator environment error') * * if emu_env_w32_eip_check(_env) is NULL: # <<<<<<<<<<<<<< + * emu_env_free(_env) * return False - * */ __pyx_t_1 = ((emu_env_w32_eip_check(__pyx_v__env) == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1236 + /* "pylibemu.pyx":1237 * * if emu_env_w32_eip_check(_env) is NULL: + * emu_env_free(_env) # <<<<<<<<<<<<<< + * return False + * + */ + emu_env_free(__pyx_v__env); + + /* "pylibemu.pyx":1238 + * if emu_env_w32_eip_check(_env) is NULL: + * emu_env_free(_env) * return False # <<<<<<<<<<<<<< * - * return True + * emu_env_free(_env) */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_False); @@ -9938,9 +10201,17 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ goto __pyx_L0; } - /* "pylibemu.pyx":1238 + /* "pylibemu.pyx":1240 * return False * + * emu_env_free(_env) # <<<<<<<<<<<<<< + * return True + */ + emu_env_free(__pyx_v__env); + + /* "pylibemu.pyx":1241 + * + * emu_env_free(_env) * return True # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); @@ -9948,7 +10219,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ __pyx_r = Py_True; goto __pyx_L0; - /* "pylibemu.pyx":1214 + /* "pylibemu.pyx":1215 * * # Win32 environment * def env_w32_hook_check(self): # <<<<<<<<<<<<<< @@ -10000,7 +10271,7 @@ static PyMethodDef __pyx_methods_8pylibemu_EmuProfile[] = { static PyTypeObject __pyx_type_8pylibemu_EmuProfile = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pylibemu.EmuProfile"), /*tp_name*/ + "pylibemu.EmuProfile", /*tp_name*/ sizeof(struct __pyx_obj_8pylibemu_EmuProfile), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8pylibemu_EmuProfile, /*tp_dealloc*/ @@ -10049,9 +10320,7 @@ static PyTypeObject __pyx_type_8pylibemu_EmuProfile = { 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ - #endif #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif @@ -10115,49 +10384,49 @@ static int __pyx_tp_clear_8pylibemu_Emulator(PyObject *o) { } static PyMethodDef __pyx_methods_8pylibemu_Emulator[] = { - {__Pyx_NAMESTR("free"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_5free, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("new"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_7new, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_output_size"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_9set_output_size, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("shellcode_getpc_test"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test)}, - {__Pyx_NAMESTR("prepare"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_13prepare, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_12prepare)}, - {__Pyx_NAMESTR("test"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_15test, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_14test)}, - {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_17run, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("offset"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_19offset, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("emu_profile_output"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_21emu_profile_output, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("emu_profile_truncated"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_23emu_profile_truncated, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("cpu_reg32_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_25cpu_reg32_get, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_24cpu_reg32_get)}, - {__Pyx_NAMESTR("cpu_reg32_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_26cpu_reg32_set)}, - {__Pyx_NAMESTR("cpu_reg16_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_29cpu_reg16_get, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_28cpu_reg16_get)}, - {__Pyx_NAMESTR("cpu_reg16_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_31cpu_reg16_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_30cpu_reg16_set)}, - {__Pyx_NAMESTR("cpu_reg8_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_33cpu_reg8_get, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_32cpu_reg8_get)}, - {__Pyx_NAMESTR("cpu_reg8_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_35cpu_reg8_set, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_34cpu_reg8_set)}, - {__Pyx_NAMESTR("cpu_eflags_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_37cpu_eflags_get, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_36cpu_eflags_get)}, - {__Pyx_NAMESTR("cpu_eflags_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_39cpu_eflags_set, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_38cpu_eflags_set)}, - {__Pyx_NAMESTR("cpu_eip_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_41cpu_eip_set, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_40cpu_eip_set)}, - {__Pyx_NAMESTR("cpu_eip_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_43cpu_eip_get, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_42cpu_eip_get)}, - {__Pyx_NAMESTR("cpu_parse"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_45cpu_parse, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_44cpu_parse)}, - {__Pyx_NAMESTR("cpu_step"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_47cpu_step, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_46cpu_step)}, - {__Pyx_NAMESTR("cpu_debugflag_set"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_49cpu_debugflag_set, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_48cpu_debugflag_set)}, - {__Pyx_NAMESTR("cpu_debugflag_unset"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_51cpu_debugflag_unset, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_50cpu_debugflag_unset)}, - {__Pyx_NAMESTR("cpu_get_current_instruction"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_53cpu_get_current_instruction, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_52cpu_get_current_instruction)}, - {__Pyx_NAMESTR("memory_write_byte"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_55memory_write_byte, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_54memory_write_byte)}, - {__Pyx_NAMESTR("memory_write_word"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_57memory_write_word, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_56memory_write_word)}, - {__Pyx_NAMESTR("memory_write_dword"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_59memory_write_dword, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_58memory_write_dword)}, - {__Pyx_NAMESTR("memory_write_block"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_61memory_write_block, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_60memory_write_block)}, - {__Pyx_NAMESTR("memory_read_byte"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_63memory_read_byte, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_62memory_read_byte)}, - {__Pyx_NAMESTR("memory_read_word"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_65memory_read_word, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_64memory_read_word)}, - {__Pyx_NAMESTR("memory_read_dword"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_67memory_read_dword, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_66memory_read_dword)}, - {__Pyx_NAMESTR("memory_read_block"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_69memory_read_block, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_68memory_read_block)}, - {__Pyx_NAMESTR("memory_read_string"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_71memory_read_string, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_70memory_read_string)}, - {__Pyx_NAMESTR("memory_segment_select"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_73memory_segment_select, METH_O, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_72memory_segment_select)}, - {__Pyx_NAMESTR("memory_segment_get"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_75memory_segment_get, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_74memory_segment_get)}, - {__Pyx_NAMESTR("env_w32_hook_check"), (PyCFunction)__pyx_pw_8pylibemu_8Emulator_77env_w32_hook_check, METH_NOARGS, __Pyx_DOCSTR(__pyx_doc_8pylibemu_8Emulator_76env_w32_hook_check)}, + {"free", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_5free, METH_NOARGS, 0}, + {"new", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_7new, METH_NOARGS, 0}, + {"set_output_size", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_9set_output_size, METH_O, 0}, + {"shellcode_getpc_test", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_11shellcode_getpc_test, METH_O, __pyx_doc_8pylibemu_8Emulator_10shellcode_getpc_test}, + {"prepare", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_13prepare, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_12prepare}, + {"test", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_15test, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_14test}, + {"run", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_17run, METH_VARARGS|METH_KEYWORDS, 0}, + {"offset", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_19offset, METH_NOARGS, 0}, + {"emu_profile_output", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_21emu_profile_output, METH_NOARGS, 0}, + {"emu_profile_truncated", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_23emu_profile_truncated, METH_NOARGS, 0}, + {"cpu_reg32_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_25cpu_reg32_get, METH_O, __pyx_doc_8pylibemu_8Emulator_24cpu_reg32_get}, + {"cpu_reg32_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_27cpu_reg32_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_26cpu_reg32_set}, + {"cpu_reg16_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_29cpu_reg16_get, METH_O, __pyx_doc_8pylibemu_8Emulator_28cpu_reg16_get}, + {"cpu_reg16_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_31cpu_reg16_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_30cpu_reg16_set}, + {"cpu_reg8_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_33cpu_reg8_get, METH_O, __pyx_doc_8pylibemu_8Emulator_32cpu_reg8_get}, + {"cpu_reg8_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_35cpu_reg8_set, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_34cpu_reg8_set}, + {"cpu_eflags_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_37cpu_eflags_get, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_36cpu_eflags_get}, + {"cpu_eflags_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_39cpu_eflags_set, METH_O, __pyx_doc_8pylibemu_8Emulator_38cpu_eflags_set}, + {"cpu_eip_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_41cpu_eip_set, METH_O, __pyx_doc_8pylibemu_8Emulator_40cpu_eip_set}, + {"cpu_eip_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_43cpu_eip_get, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_42cpu_eip_get}, + {"cpu_parse", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_45cpu_parse, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_44cpu_parse}, + {"cpu_step", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_47cpu_step, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_46cpu_step}, + {"cpu_debugflag_set", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_49cpu_debugflag_set, METH_O, __pyx_doc_8pylibemu_8Emulator_48cpu_debugflag_set}, + {"cpu_debugflag_unset", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_51cpu_debugflag_unset, METH_O, __pyx_doc_8pylibemu_8Emulator_50cpu_debugflag_unset}, + {"cpu_get_current_instruction", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_53cpu_get_current_instruction, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_52cpu_get_current_instruction}, + {"memory_write_byte", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_55memory_write_byte, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_54memory_write_byte}, + {"memory_write_word", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_57memory_write_word, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_56memory_write_word}, + {"memory_write_dword", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_59memory_write_dword, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_58memory_write_dword}, + {"memory_write_block", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_61memory_write_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_60memory_write_block}, + {"memory_read_byte", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_63memory_read_byte, METH_O, __pyx_doc_8pylibemu_8Emulator_62memory_read_byte}, + {"memory_read_word", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_65memory_read_word, METH_O, __pyx_doc_8pylibemu_8Emulator_64memory_read_word}, + {"memory_read_dword", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_67memory_read_dword, METH_O, __pyx_doc_8pylibemu_8Emulator_66memory_read_dword}, + {"memory_read_block", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_69memory_read_block, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_68memory_read_block}, + {"memory_read_string", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_71memory_read_string, METH_VARARGS|METH_KEYWORDS, __pyx_doc_8pylibemu_8Emulator_70memory_read_string}, + {"memory_segment_select", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_73memory_segment_select, METH_O, __pyx_doc_8pylibemu_8Emulator_72memory_segment_select}, + {"memory_segment_get", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_75memory_segment_get, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_74memory_segment_get}, + {"env_w32_hook_check", (PyCFunction)__pyx_pw_8pylibemu_8Emulator_77env_w32_hook_check, METH_NOARGS, __pyx_doc_8pylibemu_8Emulator_76env_w32_hook_check}, {0, 0, 0, 0} }; static PyTypeObject __pyx_type_8pylibemu_Emulator = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("pylibemu.Emulator"), /*tp_name*/ + "pylibemu.Emulator", /*tp_name*/ sizeof(struct __pyx_obj_8pylibemu_Emulator), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_8pylibemu_Emulator, /*tp_dealloc*/ @@ -10206,9 +10475,7 @@ static PyTypeObject __pyx_type_8pylibemu_Emulator = { 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ - #endif #if PY_VERSION_HEX >= 0x030400a1 0, /*tp_finalize*/ #endif @@ -10225,7 +10492,7 @@ static struct PyModuleDef __pyx_moduledef = { #else PyModuleDef_HEAD_INIT, #endif - __Pyx_NAMESTR("pylibemu"), + "pylibemu", 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -10334,10 +10601,10 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -10413,344 +10680,344 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "pylibemu.pyx":659 + /* "pylibemu.pyx":660 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 660; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - /* "pylibemu.pyx":687 + /* "pylibemu.pyx":688 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 688; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - /* "pylibemu.pyx":715 + /* "pylibemu.pyx":716 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 716; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__11); __Pyx_GIVEREF(__pyx_tuple__11); - /* "pylibemu.pyx":743 + /* "pylibemu.pyx":744 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 744; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__12); __Pyx_GIVEREF(__pyx_tuple__12); - /* "pylibemu.pyx":771 + /* "pylibemu.pyx":772 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__13); __Pyx_GIVEREF(__pyx_tuple__13); - /* "pylibemu.pyx":799 + /* "pylibemu.pyx":800 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__14); __Pyx_GIVEREF(__pyx_tuple__14); - /* "pylibemu.pyx":816 + /* "pylibemu.pyx":817 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__15); __Pyx_GIVEREF(__pyx_tuple__15); - /* "pylibemu.pyx":833 + /* "pylibemu.pyx":834 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__16); __Pyx_GIVEREF(__pyx_tuple__16); - /* "pylibemu.pyx":850 + /* "pylibemu.pyx":851 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 850; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__17 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__17); __Pyx_GIVEREF(__pyx_tuple__17); - /* "pylibemu.pyx":867 + /* "pylibemu.pyx":868 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - /* "pylibemu.pyx":881 + /* "pylibemu.pyx":882 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 881; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - /* "pylibemu.pyx":895 + /* "pylibemu.pyx":896 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__20); __Pyx_GIVEREF(__pyx_tuple__20); - /* "pylibemu.pyx":912 + /* "pylibemu.pyx":913 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 912; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - /* "pylibemu.pyx":929 + /* "pylibemu.pyx":930 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _cpu = emu_cpu_get(self._emu) */ - __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__22); __Pyx_GIVEREF(__pyx_tuple__22); - /* "pylibemu.pyx":944 + /* "pylibemu.pyx":945 * ''' * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * self.cpu_debugflag_set(1) */ - __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 944; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 945; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - /* "pylibemu.pyx":946 + /* "pylibemu.pyx":947 * raise RuntimeError('Emulator not initialized') * * self.cpu_debugflag_set(1) # <<<<<<<<<<<<<< * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string */ - __pyx_tuple__24 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 946; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__24 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 947; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__24); __Pyx_GIVEREF(__pyx_tuple__24); - /* "pylibemu.pyx":949 + /* "pylibemu.pyx":950 * self.cpu_parse() * instr_string = emu_cpu_get(self._emu).instr_string * self.cpu_debugflag_unset(1) # <<<<<<<<<<<<<< * * return instr_string */ - __pyx_tuple__25 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 949; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 950; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - /* "pylibemu.pyx":969 + /* "pylibemu.pyx":970 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 969; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 970; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__26); __Pyx_GIVEREF(__pyx_tuple__26); - /* "pylibemu.pyx":989 + /* "pylibemu.pyx":990 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 989; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 990; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - /* "pylibemu.pyx":1009 + /* "pylibemu.pyx":1010 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1009; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__28 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1010; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__28); __Pyx_GIVEREF(__pyx_tuple__28); - /* "pylibemu.pyx":1032 + /* "pylibemu.pyx":1033 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1032; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1033; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - /* "pylibemu.pyx":1053 + /* "pylibemu.pyx":1054 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__30 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1054; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__30); __Pyx_GIVEREF(__pyx_tuple__30); - /* "pylibemu.pyx":1077 + /* "pylibemu.pyx":1078 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1078; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - /* "pylibemu.pyx":1101 + /* "pylibemu.pyx":1102 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__32 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__32); __Pyx_GIVEREF(__pyx_tuple__32); - /* "pylibemu.pyx":1128 + /* "pylibemu.pyx":1129 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * block = malloc(_len) */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - /* "pylibemu.pyx":1132 + /* "pylibemu.pyx":1133 * block = malloc(_len) * if block is NULL: * raise RuntimeError('Error while allocating memory') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_Error_while_allocating_memory); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__34 = PyTuple_Pack(1, __pyx_kp_s_Error_while_allocating_memory); if (unlikely(!__pyx_tuple__34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - /* "pylibemu.pyx":1159 + /* "pylibemu.pyx":1160 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - /* "pylibemu.pyx":1185 + /* "pylibemu.pyx":1186 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); - /* "pylibemu.pyx":1208 + /* "pylibemu.pyx":1209 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); - /* "pylibemu.pyx":1228 + /* "pylibemu.pyx":1229 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _env = emu_env_new(self._emu) */ - __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); - /* "pylibemu.pyx":1233 + /* "pylibemu.pyx":1234 * if _env is NULL: * print emu_strerror(self._emu) * raise RuntimeError('Emulator environment error') # <<<<<<<<<<<<<< * * if emu_env_w32_eip_check(_env) is NULL: */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_Emulator_environment_error); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_Emulator_environment_error); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); __Pyx_RefNannyFinishContext(); @@ -10830,25 +11097,25 @@ PyMODINIT_FUNC PyInit_pylibemu(void) #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("pylibemu"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + __pyx_m = Py_InitModule4("pylibemu", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if CYTHON_COMPILING_IN_PYPY Py_INCREF(__pyx_b); #endif - if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif if (__pyx_module_is_main_pylibemu) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } #if PY_MAJOR_VERSION >= 3 { @@ -10892,7 +11159,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) if (PyType_Ready(&__pyx_type_8pylibemu_EmuProfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_8pylibemu_EmuProfile.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_8pylibemu_EmuProfile.tp_dict, __pyx_vtabptr_8pylibemu_EmuProfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "EmuProfile", (PyObject *)&__pyx_type_8pylibemu_EmuProfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "EmuProfile", (PyObject *)&__pyx_type_8pylibemu_EmuProfile) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8pylibemu_EmuProfile = &__pyx_type_8pylibemu_EmuProfile; __pyx_vtabptr_8pylibemu_Emulator = &__pyx_vtable_8pylibemu_Emulator; __pyx_vtable_8pylibemu_Emulator.check_stop_emulation = (PyObject *(*)(struct __pyx_obj_8pylibemu_Emulator *, struct emu_env_hook *))__pyx_f_8pylibemu_8Emulator_check_stop_emulation; @@ -10901,7 +11168,7 @@ PyMODINIT_FUNC PyInit_pylibemu(void) if (PyType_Ready(&__pyx_type_8pylibemu_Emulator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_type_8pylibemu_Emulator.tp_print = 0; if (__Pyx_SetVtable(__pyx_type_8pylibemu_Emulator.tp_dict, __pyx_vtabptr_8pylibemu_Emulator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Emulator", (PyObject *)&__pyx_type_8pylibemu_Emulator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttrString(__pyx_m, "Emulator", (PyObject *)&__pyx_type_8pylibemu_Emulator) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_8pylibemu_Emulator = &__pyx_type_8pylibemu_Emulator; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -11177,90 +11444,90 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "pylibemu.pyx":624 + /* "pylibemu.pyx":625 * * @property * def offset(self): # <<<<<<<<<<<<<< * return self._offset * */ - __pyx_t_5 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_offset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_offset); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "pylibemu.pyx":623 + /* "pylibemu.pyx":624 * return self.test(steps = steps) * * @property # <<<<<<<<<<<<<< * def offset(self): * return self._offset */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_offset, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_offset, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_8pylibemu_Emulator); - /* "pylibemu.pyx":628 + /* "pylibemu.pyx":629 * * @property * def emu_profile_output(self): # <<<<<<<<<<<<<< * return self.emu_profile.output * */ - __pyx_t_5 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_emu_profile_output); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_emu_profile_output); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "pylibemu.pyx":627 + /* "pylibemu.pyx":628 * return self._offset * * @property # <<<<<<<<<<<<<< * def emu_profile_output(self): * return self.emu_profile.output */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_emu_profile_output, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 628; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_emu_profile_output, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_8pylibemu_Emulator); - /* "pylibemu.pyx":632 + /* "pylibemu.pyx":633 * * @property * def emu_profile_truncated(self): # <<<<<<<<<<<<<< * return self.emu_profile.truncate * */ - __pyx_t_5 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_emu_profile_truncated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetNameInClass((PyObject *)__pyx_ptype_8pylibemu_Emulator, __pyx_n_s_emu_profile_truncated); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "pylibemu.pyx":631 + /* "pylibemu.pyx":632 * return self.emu_profile.output * * @property # <<<<<<<<<<<<<< * def emu_profile_truncated(self): * return self.emu_profile.truncate */ - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_property, __pyx_t_7, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_emu_profile_truncated, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem((PyObject *)__pyx_ptype_8pylibemu_Emulator->tp_dict, __pyx_n_s_emu_profile_truncated, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; PyType_Modified(__pyx_ptype_8pylibemu_Emulator); @@ -11273,6 +11540,9 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __Pyx_GOTREF(__pyx_t_5); if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_2, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /*--- Wrapped vars code ---*/ + goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); @@ -11280,7 +11550,9 @@ PyMODINIT_FUNC PyInit_pylibemu(void) __Pyx_XDECREF(__pyx_t_7); __Pyx_XDECREF(__pyx_t_8); if (__pyx_m) { - __Pyx_AddTraceback("init pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__pyx_d) { + __Pyx_AddTraceback("init pylibemu", __pyx_clineno, __pyx_lineno, __pyx_filename); + } Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init pylibemu"); @@ -11309,7 +11581,7 @@ static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } -#endif /* CYTHON_REFNANNY */ +#endif static PyObject *__Pyx_GetBuiltinName(PyObject *name) { PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); @@ -11328,7 +11600,7 @@ static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { PyObject *result; #if CYTHON_COMPILING_IN_CPYTHON result = PyDict_GetItem(__pyx_d, name); - if (result) { + if (likely(result)) { Py_INCREF(result); } else { #else @@ -11373,14 +11645,29 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg ternaryfunc call = func->ob_type->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); -#if PY_VERSION_HEX >= 0x02060000 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) return NULL; -#endif result = (*call)(func, arg, kw); -#if PY_VERSION_HEX >= 0x02060000 Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} #endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) { + PyObject *self, *result; + PyCFunction cfunc; + cfunc = PyCFunction_GET_FUNCTION(func); + self = PyCFunction_GET_SELF(func); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = cfunc(self, arg); + Py_LeaveRecursiveCall(); if (unlikely(!result) && unlikely(!PyErr_Occurred())) { PyErr_SetString( PyExc_SystemError, @@ -11390,6 +11677,51 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg } #endif +#if CYTHON_COMPILING_IN_CPYTHON +static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *result; + PyObject *args = PyTuple_New(1); + if (unlikely(!args)) return NULL; + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 0, arg); + result = __Pyx_PyObject_Call(func, args, NULL); + Py_DECREF(args); + return result; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { + return __Pyx_PyObject_CallMethO(func, arg); + } + } + return __Pyx__PyObject_CallOneArg(func, arg); +} +#else +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject* args = PyTuple_Pack(1, arg); + return (likely(args)) ? __Pyx_PyObject_Call(func, args, NULL) : NULL; +} +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) { +#else + if (likely(PyCFunction_Check(func))) { +#endif + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { #if CYTHON_COMPILING_IN_CPYTHON PyThreadState *tstate = PyThreadState_GET(); @@ -11746,10 +12078,8 @@ static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int Py_ssize_t length; int kind; void *data1, *data2; - #if CYTHON_PEP393_ENABLED - if (unlikely(PyUnicode_READY(s1) < 0) || unlikely(PyUnicode_READY(s2) < 0)) + if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0)) return -1; - #endif length = __Pyx_PyUnicode_GET_LENGTH(s1); if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) { goto return_ne; @@ -11815,11 +12145,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, goto raise_error; } } - #if PY_VERSION_HEX < 0x02050000 - if (PyClass_Check(type)) { - #else if (PyType_Check(type)) { - #endif #if CYTHON_COMPILING_IN_PYPY if (!value) { Py_INCREF(Py_None); @@ -11834,17 +12160,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, goto raise_error; } value = type; - #if PY_VERSION_HEX < 0x02050000 - if (PyInstance_Check(type)) { - type = (PyObject*) ((PyInstanceObject*)type)->in_class; - Py_INCREF(type); - } else { - type = 0; - PyErr_SetString(PyExc_TypeError, - "raise: exception must be an old-style class or instance"); - goto raise_error; - } - #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { @@ -11852,7 +12167,6 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, "raise: exception class must be a subclass of BaseException"); goto raise_error; } - #endif } __Pyx_ErrRestore(type, value, tb); return; @@ -11862,7 +12176,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, Py_XDECREF(tb); return; } -#else /* Python 3+ */ +#else static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { PyObject* owned_instance = NULL; if (tb == Py_None) { @@ -11948,6 +12262,13 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject } PyErr_SetObject(type, value); if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(tmp_type, tmp_value, tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { @@ -11955,6 +12276,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } +#endif } bad: Py_XDECREF(owned_instance); @@ -11963,7 +12285,7 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject #endif static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) +#if PY_VERSION_HEX >= 0x02070000 PyObject *ob = PyCapsule_New(vtable, 0, 0); #else PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); @@ -12091,122 +12413,270 @@ static PyObject *__Pyx_GetNameInClass(PyObject *nmspace, PyObject *name) { return result; } -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *empty_list = 0; - PyObject *module = 0; - PyObject *global_dict = 0; - PyObject *empty_dict = 0; - PyObject *list; - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (!py_import) - goto bad; - #endif - if (from_list) - list = from_list; - else { - empty_list = PyList_New(0); - if (!empty_list) - goto bad; - list = empty_list; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; } - global_dict = PyModule_GetDict(__pyx_m); - if (!global_dict) - goto bad; - empty_dict = PyDict_New(); - if (!empty_dict) - goto bad; - #if PY_VERSION_HEX >= 0x02050000 - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(1); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, 1); - #endif - if (!module) { - if (!PyErr_ExceptionMatches(PyExc_ImportError)) - goto bad; - PyErr_Clear(); - } - } - level = 0; /* try absolute import on failure */ - } - #endif - if (!module) { - #if PY_VERSION_HEX < 0x03030000 - PyObject *py_level = PyInt_FromLong(level); - if (!py_level) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, py_level, NULL); - Py_DECREF(py_level); - #else - module = PyImport_ImportModuleLevelObject( - name, global_dict, empty_dict, list, level); - #endif + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; } } - #else - if (level>0) { - PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); - goto bad; + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; } - module = PyObject_CallFunctionObjArgs(py_import, - name, global_dict, empty_dict, list, NULL); - #endif -bad: - #if PY_VERSION_HEX < 0x03030000 - Py_XDECREF(py_import); - #endif - Py_XDECREF(empty_list); - Py_XDECREF(empty_dict); - return module; } - -#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func) \ - { \ - func_type value = func(x); \ - if (sizeof(target_type) < sizeof(func_type)) { \ - if (unlikely(value != (func_type) (target_type) value)) { \ - func_type zero = 0; \ - PyErr_SetString(PyExc_OverflowError, \ - (is_unsigned && unlikely(value < zero)) ? \ - "can't convert negative value to " #target_type : \ - "value too large to convert to " #target_type); \ - return (target_type) -1; \ - } \ - } \ - return (target_type) value; \ +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; } - -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, + 0, + 0, + 0, + 0, + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + __pyx_d, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +#define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value) \ + { \ + func_type value = func_value; \ + if (sizeof(target_type) < sizeof(func_type)) { \ + if (unlikely(value != (func_type) (target_type) value)) { \ + func_type zero = 0; \ + if (is_unsigned && unlikely(value < zero)) \ + goto raise_neg_overflow; \ + else \ + goto raise_overflow; \ + } \ + } \ + return (target_type) value; \ + } + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 + #if CYTHON_USE_PYLONG_INTERNALS + #include "longintrepr.h" + #endif +#endif + static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { const size_t neg_one = (size_t) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(size_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t) -1; + goto raise_neg_overflow; } return (size_t) val; } @@ -12216,40 +12686,34 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(size_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (size_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t) -1; + goto raise_neg_overflow; } if (sizeof(size_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(size_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(size_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(size_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(size_t) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(size_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(size_t, long, PyLong_AsLong(x)) } else if (sizeof(size_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(size_t, long long, PyLong_AsLongLong(x)) } } { @@ -12287,26 +12751,27 @@ static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { const uint32_t neg_one = (uint32_t) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(uint32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint32_t"); - return (uint32_t) -1; + goto raise_neg_overflow; } return (uint32_t) val; } @@ -12316,40 +12781,34 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(uint32_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (uint32_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint32_t"); - return (uint32_t) -1; + goto raise_neg_overflow; } if (sizeof(uint32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(uint32_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(uint32_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(uint32_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(uint32_t) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(uint32_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(uint32_t, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(uint32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(uint32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(uint32_t, long, PyLong_AsLong(x)) } else if (sizeof(uint32_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(uint32_t, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(uint32_t, long long, PyLong_AsLongLong(x)) } } { @@ -12387,26 +12846,27 @@ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint32_t"); + return (uint32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint32_t"); + return (uint32_t) -1; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { const uint16_t neg_one = (uint16_t) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(uint16_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(uint16_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint16_t"); - return (uint16_t) -1; + goto raise_neg_overflow; } return (uint16_t) val; } @@ -12416,40 +12876,34 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(uint16_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (uint16_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint16_t"); - return (uint16_t) -1; + goto raise_neg_overflow; } if (sizeof(uint16_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(uint16_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(uint16_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(uint16_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(uint16_t) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(uint16_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(uint16_t, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(uint16_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(uint16_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint16_t, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(uint16_t, long, PyLong_AsLong(x)) } else if (sizeof(uint16_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(uint16_t, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(uint16_t, long long, PyLong_AsLongLong(x)) } } { @@ -12487,26 +12941,27 @@ static CYTHON_INLINE uint16_t __Pyx_PyInt_As_uint16_t(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint16_t"); + return (uint16_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint16_t"); + return (uint16_t) -1; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { const uint8_t neg_one = (uint8_t) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(uint8_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(uint8_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint8_t"); - return (uint8_t) -1; + goto raise_neg_overflow; } return (uint8_t) val; } @@ -12516,40 +12971,34 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(uint8_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (uint8_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to uint8_t"); - return (uint8_t) -1; + goto raise_neg_overflow; } if (sizeof(uint8_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(uint8_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(uint8_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(uint8_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(uint8_t) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(uint8_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(uint8_t, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(uint8_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(uint8_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(uint8_t, long, PyLong_AsLong(x)) } else if (sizeof(uint8_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(uint8_t, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(uint8_t, long long, PyLong_AsLongLong(x)) } } { @@ -12587,26 +13036,27 @@ static CYTHON_INLINE uint8_t __Pyx_PyInt_As_uint8_t(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to uint8_t"); + return (uint8_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to uint8_t"); + return (uint8_t) -1; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { const int neg_one = (int) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + goto raise_neg_overflow; } return (int) val; } @@ -12616,40 +13066,34 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(int)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (int) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; + goto raise_neg_overflow; } if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(int, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(int) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(int, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(int)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(int) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(int) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(int, long, PyLong_AsLong(x)) } else if (sizeof(int) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(int, long long, PyLong_AsLongLong(x)) } } { @@ -12687,6 +13131,14 @@ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int"); + return (int) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int"); + return (int) -1; } static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int32_t(int32_t value) { @@ -12790,7 +13242,7 @@ static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { Py_DECREF(f); return -1; } -#else /* Python 3 has a print function */ +#else static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { PyObject* kwargs = 0; PyObject* result = 0; @@ -12870,7 +13322,7 @@ static int __Pyx_PrintOne(PyObject* f, PyObject *o) { * warnings about unused functions */ return __Pyx_Print(f, NULL, 0); } -#else /* Python 3 has a print function */ +#else static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { int res; PyObject* arg_tuple = PyTuple_Pack(1, o); @@ -12882,24 +13334,17 @@ static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { } #endif -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { const int32_t neg_one = (int32_t) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(int32_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(int32_t, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int32_t"); - return (int32_t) -1; + goto raise_neg_overflow; } return (int32_t) val; } @@ -12909,40 +13354,34 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(int32_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (int32_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int32_t"); - return (int32_t) -1; + goto raise_neg_overflow; } if (sizeof(int32_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(int32_t) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(int32_t, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(int32_t, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(int32_t)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(int32_t) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(int32_t) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(int32_t, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(int32_t, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(int32_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int32_t, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(int32_t, long, PyLong_AsLong(x)) } else if (sizeof(int32_t) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(int32_t, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(int32_t, long long, PyLong_AsLongLong(x)) } } { @@ -12980,6 +13419,14 @@ static CYTHON_INLINE int32_t __Pyx_PyInt_As_int32_t(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to int32_t"); + return (int32_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to int32_t"); + return (int32_t) -1; } static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { @@ -13060,24 +13507,17 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint8_t(uint8_t value) { } } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) -1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { if (sizeof(long) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG) + __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; + goto raise_neg_overflow; } return (long) val; } @@ -13087,40 +13527,34 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { if (is_unsigned) { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long) -1; + goto raise_neg_overflow; } if (sizeof(long) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong) + __PYX_VERIFY_RETURN_INT(long, unsigned long, PyLong_AsUnsignedLong(x)) } else if (sizeof(long) <= sizeof(unsigned long long)) { - __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong) + __PYX_VERIFY_RETURN_INT(long, unsigned long long, PyLong_AsUnsignedLongLong(x)) } } else { #if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_USE_PYLONG_INTERNALS - if (sizeof(digit) <= sizeof(long)) { - switch (Py_SIZE(x)) { - case 0: return 0; - case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; - case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; - } + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: __PYX_VERIFY_RETURN_INT(long, digit, +(((PyLongObject*)x)->ob_digit[0])); + case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, -(sdigit) ((PyLongObject*)x)->ob_digit[0]); } #endif #endif if (sizeof(long) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong) + __PYX_VERIFY_RETURN_INT(long, long, PyLong_AsLong(x)) } else if (sizeof(long) <= sizeof(long long)) { - __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong) + __PYX_VERIFY_RETURN_INT(long, long long, PyLong_AsLongLong(x)) } } { @@ -13158,6 +13592,14 @@ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { Py_DECREF(tmp); return val; } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to long"); + return (long) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long) -1; } static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { @@ -13196,11 +13638,7 @@ static int __Pyx_check_binary_version(void) { "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); - #if PY_VERSION_HEX < 0x02050000 - return PyErr_Warn(NULL, message); - #else return PyErr_WarnEx(NULL, message, 1); - #endif } return 0; } @@ -13270,11 +13708,7 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class PyOS_snprintf(warning, sizeof(warning), "%s.%s size changed, may indicate binary incompatibility", module_name, class_name); - #if PY_VERSION_HEX < 0x02050000 - if (PyErr_Warn(NULL, warning) < 0) goto bad; - #else if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; - #endif } else if ((size_t)basicsize != size) { PyErr_Format(PyExc_ValueError, @@ -13290,168 +13724,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { - int start = 0, mid = 0, end = count - 1; - if (end >= 0 && code_line > entries[end].code_line) { - return count; - } - while (start < end) { - mid = (start + end) / 2; - if (code_line < entries[mid].code_line) { - end = mid; - } else if (code_line > entries[mid].code_line) { - start = mid + 1; - } else { - return mid; - } - } - if (code_line <= entries[mid].code_line) { - return mid; - } else { - return mid + 1; - } -} -static PyCodeObject *__pyx_find_code_object(int code_line) { - PyCodeObject* code_object; - int pos; - if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { - return NULL; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { - return NULL; - } - code_object = __pyx_code_cache.entries[pos].code_object; - Py_INCREF(code_object); - return code_object; -} -static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { - int pos, i; - __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; - if (unlikely(!code_line)) { - return; - } - if (unlikely(!entries)) { - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); - if (likely(entries)) { - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = 64; - __pyx_code_cache.count = 1; - entries[0].code_line = code_line; - entries[0].code_object = code_object; - Py_INCREF(code_object); - } - return; - } - pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); - if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { - PyCodeObject* tmp = entries[pos].code_object; - entries[pos].code_object = code_object; - Py_DECREF(tmp); - return; - } - if (__pyx_code_cache.count == __pyx_code_cache.max_count) { - int new_max = __pyx_code_cache.max_count + 64; - entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); - if (unlikely(!entries)) { - return; - } - __pyx_code_cache.entries = entries; - __pyx_code_cache.max_count = new_max; - } - for (i=__pyx_code_cache.count; i>pos; i--) { - entries[i] = entries[i-1]; - } - entries[pos].code_line = code_line; - entries[pos].code_object = code_object; - __pyx_code_cache.count++; - Py_INCREF(code_object); -} - -#include "compile.h" -#include "frameobject.h" -#include "traceback.h" -static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( - const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; - #if PY_MAJOR_VERSION < 3 - py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif - if (!py_srcfile) goto bad; - if (c_line) { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #else - py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); - #endif - } - else { - #if PY_MAJOR_VERSION < 3 - py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); - #endif - } - if (!py_funcname) goto bad; - py_code = __Pyx_PyCode_New( - 0, /*int argcount,*/ - 0, /*int kwonlyargcount,*/ - 0, /*int nlocals,*/ - 0, /*int stacksize,*/ - 0, /*int flags,*/ - __pyx_empty_bytes, /*PyObject *code,*/ - __pyx_empty_tuple, /*PyObject *consts,*/ - __pyx_empty_tuple, /*PyObject *names,*/ - __pyx_empty_tuple, /*PyObject *varnames,*/ - __pyx_empty_tuple, /*PyObject *freevars,*/ - __pyx_empty_tuple, /*PyObject *cellvars,*/ - py_srcfile, /*PyObject *filename,*/ - py_funcname, /*PyObject *name,*/ - py_line, /*int firstlineno,*/ - __pyx_empty_bytes /*PyObject *lnotab*/ - ); - Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); - return py_code; -bad: - Py_XDECREF(py_srcfile); - Py_XDECREF(py_funcname); - return NULL; -} -static void __Pyx_AddTraceback(const char *funcname, int c_line, - int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_globals = 0; - PyFrameObject *py_frame = 0; - py_code = __pyx_find_code_object(c_line ? c_line : py_line); - if (!py_code) { - py_code = __Pyx_CreateCodeObjectForTraceback( - funcname, c_line, py_line, filename); - if (!py_code) goto bad; - __pyx_insert_code_object(c_line ? c_line : py_line, py_code); - } - py_globals = PyModule_GetDict(__pyx_m); - if (!py_globals) goto bad; - py_frame = PyFrame_New( - PyThreadState_GET(), /*PyThreadState *tstate,*/ - py_code, /*PyCodeObject *code,*/ - py_globals, /*PyObject *globals,*/ - 0 /*PyObject *locals*/ - ); - if (!py_frame) goto bad; - py_frame->f_lineno = py_line; - PyTraceBack_Here(py_frame); -bad: - Py_XDECREF(py_code); - Py_XDECREF(py_frame); -} - static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 @@ -13462,7 +13734,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } - #else /* Python 3+ has unicode identifiers */ + #else if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); @@ -13512,11 +13784,11 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ } } } -#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ +#endif *length = PyBytes_GET_SIZE(defenc); return defenc_c; -#else /* PY_VERSION_HEX < 0x03030000 */ - if (PyUnicode_READY(o) == -1) return NULL; +#else + if (__Pyx_PyUnicode_READY(o) == -1) return NULL; #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII if (PyUnicode_IS_ASCII(o)) { *length = PyUnicode_GET_LENGTH(o); @@ -13525,19 +13797,17 @@ static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_ PyUnicode_AsASCIIString(o); return NULL; } -#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#else return PyUnicode_AsUTF8AndSize(o, length); -#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ -#endif /* PY_VERSION_HEX < 0x03030000 */ +#endif +#endif } else -#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ +#endif #if !CYTHON_COMPILING_IN_PYPY -#if PY_VERSION_HEX >= 0x02060000 if (PyByteArray_Check(o)) { *length = PyByteArray_GET_SIZE(o); return PyByteArray_AS_STRING(o); } else -#endif #endif { char* result; @@ -13599,11 +13869,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { } return res; } -#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 - #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" - #endif -#endif static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject *x; @@ -13621,11 +13886,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { } #endif #endif - #if PY_VERSION_HEX < 0x02060000 - return PyInt_AsSsize_t(b); - #else return PyLong_AsSsize_t(b); - #endif } x = PyNumber_Index(b); if (!x) return -1; @@ -13634,17 +13895,7 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { -#if PY_VERSION_HEX < 0x02050000 - if (ival <= LONG_MAX) - return PyInt_FromLong((long)ival); - else { - unsigned char *bytes = (unsigned char *) &ival; - int one = 1; int little = (int)*(unsigned char*)&one; - return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); - } -#else - return PyInt_FromSize_t(ival); -#endif + return PyInt_FromSize_t(ival); } diff --git a/src/pylibemu.pyx b/src/pylibemu.pyx index 3820877..20cbcbf 100644 --- a/src/pylibemu.pyx +++ b/src/pylibemu.pyx @@ -608,6 +608,7 @@ cdef class Emulator: break self.emu_profile.emu_profile_debug(_env) + emu_env_free(_env) return 0 cpdef int run(self, shellcode, steps = 1000000): @@ -1233,6 +1234,8 @@ cdef class Emulator: raise RuntimeError('Emulator environment error') if emu_env_w32_eip_check(_env) is NULL: + emu_env_free(_env) return False + emu_env_free(_env) return True From b2318ace5c65bf5b67b588e187abdcc03edcd888 Mon Sep 17 00:00:00 2001 From: bwall Date: Sat, 26 Sep 2015 13:41:32 -0400 Subject: [PATCH 2/2] Copies then frees data being read from emulator memory before returning it for use --- src/pylibemu.c | 209 +++++++++++++++++++++++++++++------------------ src/pylibemu.pyx | 12 ++- 2 files changed, 139 insertions(+), 82 deletions(-) diff --git a/src/pylibemu.c b/src/pylibemu.c index d1533c8..44fbf3b 100644 --- a/src/pylibemu.c +++ b/src/pylibemu.c @@ -9519,6 +9519,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_69memory_read_block(PyObject *__py static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, uint32_t __pyx_v_addr, size_t __pyx_v__len) { struct emu_memory *__pyx_v__mem; void *__pyx_v_block; + char *__pyx_v_data; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -9610,7 +9611,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o * if emu_memory_read_block(_mem, addr, block, _len): * raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * - * return block + * data = (block) */ __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -9638,12 +9639,30 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o /* "pylibemu.pyx":1139 * raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) * - * return block # <<<<<<<<<<<<<< + * data = (block) # <<<<<<<<<<<<<< + * free(block) + * + */ + __pyx_v_data = ((char *)__pyx_v_block); + + /* "pylibemu.pyx":1140 + * + * data = (block) + * free(block) # <<<<<<<<<<<<<< + * + * return data + */ + free(__pyx_v_block); + + /* "pylibemu.pyx":1142 + * free(block) + * + * return data # <<<<<<<<<<<<<< * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_block)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -9669,8 +9688,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_68memory_read_block(struct __pyx_o return __pyx_r; } -/* "pylibemu.pyx":1141 - * return block +/* "pylibemu.pyx":1144 + * return data * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< * ''' @@ -9709,11 +9728,11 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_71memory_read_string(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_maxsize)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_string") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "memory_read_string") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -9721,12 +9740,12 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_71memory_read_string(PyObject *__p values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_maxsize = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_maxsize == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_addr = __Pyx_PyInt_As_uint32_t(values[0]); if (unlikely((__pyx_v_addr == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_maxsize = __Pyx_PyInt_As_uint32_t(values[1]); if (unlikely((__pyx_v_maxsize == (uint32_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("memory_read_string", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1144; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("pylibemu.Emulator.memory_read_string", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -9742,6 +9761,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_71memory_read_string(PyObject *__p static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_obj_8pylibemu_Emulator *__pyx_v_self, uint32_t __pyx_v_addr, uint32_t __pyx_v_maxsize) { struct emu_memory *__pyx_v__mem; struct emu_string __pyx_v_s; + char *__pyx_v_data; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; @@ -9752,7 +9772,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_read_string", 0); - /* "pylibemu.pyx":1159 + /* "pylibemu.pyx":1162 * cdef c_emu_string s * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9762,85 +9782,112 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1160 + /* "pylibemu.pyx":1163 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__35, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1162 + /* "pylibemu.pyx":1165 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< * if emu_memory_read_string(_mem, addr, &s, maxsize): - * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) + * free(s.data) */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1163 + /* "pylibemu.pyx":1166 * * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): # <<<<<<<<<<<<<< + * free(s.data) * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) - * */ __pyx_t_1 = (emu_memory_read_string(__pyx_v__mem, __pyx_v_addr, (&__pyx_v_s), __pyx_v_maxsize) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1164 + /* "pylibemu.pyx":1167 * _mem = emu_memory_get(self._emu) * if emu_memory_read_string(_mem, addr, &s, maxsize): + * free(s.data) # <<<<<<<<<<<<<< + * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) + * + */ + free(__pyx_v_s.data); + + /* "pylibemu.pyx":1168 + * if emu_memory_read_string(_mem, addr, &s, maxsize): + * free(s.data) * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) # <<<<<<<<<<<<<< * - * return s.data + * data = (s.data) */ - __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_From_uint32_t(__pyx_v_addr); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_string_at, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyString_Format(__pyx_kp_s_Error_while_reading_a_string_at, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1166 + /* "pylibemu.pyx":1170 * raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) * - * return s.data # <<<<<<<<<<<<<< + * data = (s.data) # <<<<<<<<<<<<<< + * free(s.data) + * + */ + __pyx_v_data = ((char *)__pyx_v_s.data); + + /* "pylibemu.pyx":1171 + * + * data = (s.data) + * free(s.data) # <<<<<<<<<<<<<< + * + * return data + */ + free(__pyx_v_s.data); + + /* "pylibemu.pyx":1173 + * free(s.data) + * + * return data # <<<<<<<<<<<<<< * * def memory_segment_select(self, c_emu_segment segment): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBytes_FromString(((char *)__pyx_v_s.data)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1166; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(__pyx_v_data); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1141 - * return block + /* "pylibemu.pyx":1144 + * return data * * def memory_read_string(self, uint32_t addr, uint32_t maxsize): # <<<<<<<<<<<<<< * ''' @@ -9859,8 +9906,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_70memory_read_string(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1168 - * return s.data +/* "pylibemu.pyx":1175 + * return data * * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< * ''' @@ -9879,7 +9926,7 @@ static PyObject *__pyx_pw_8pylibemu_8Emulator_73memory_segment_select(PyObject * __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("memory_segment_select (wrapper)", 0); assert(__pyx_arg_segment); { - __pyx_v_segment = ((enum emu_segment)PyInt_AsLong(__pyx_arg_segment)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1168; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_segment = ((enum emu_segment)PyInt_AsLong(__pyx_arg_segment)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1175; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -9905,7 +9952,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_segment_select", 0); - /* "pylibemu.pyx":1185 + /* "pylibemu.pyx":1192 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -9915,21 +9962,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1186 + /* "pylibemu.pyx":1193 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__36, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1188 + /* "pylibemu.pyx":1195 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -9938,7 +9985,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1189 + /* "pylibemu.pyx":1196 * * _mem = emu_memory_get(self._emu) * emu_memory_segment_select(_mem, segment) # <<<<<<<<<<<<<< @@ -9947,8 +9994,8 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p */ emu_memory_segment_select(__pyx_v__mem, __pyx_v_segment); - /* "pylibemu.pyx":1168 - * return s.data + /* "pylibemu.pyx":1175 + * return data * * def memory_segment_select(self, c_emu_segment segment): # <<<<<<<<<<<<<< * ''' @@ -9968,7 +10015,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_72memory_segment_select(struct __p return __pyx_r; } -/* "pylibemu.pyx":1191 +/* "pylibemu.pyx":1198 * emu_memory_segment_select(_mem, segment) * * def memory_segment_get(self): # <<<<<<<<<<<<<< @@ -10001,7 +10048,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memory_segment_get", 0); - /* "pylibemu.pyx":1208 + /* "pylibemu.pyx":1215 * cdef c_emu_memory *_mem * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10011,21 +10058,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1209 + /* "pylibemu.pyx":1216 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__37, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1211 + /* "pylibemu.pyx":1218 * raise RuntimeError('Emulator not initialized') * * _mem = emu_memory_get(self._emu) # <<<<<<<<<<<<<< @@ -10034,7 +10081,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ */ __pyx_v__mem = emu_memory_get(__pyx_v_self->_emu); - /* "pylibemu.pyx":1212 + /* "pylibemu.pyx":1219 * * _mem = emu_memory_get(self._emu) * return emu_memory_segment_get(_mem) # <<<<<<<<<<<<<< @@ -10042,13 +10089,13 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ * # Win32 environment */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(emu_memory_segment_get(__pyx_v__mem)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(emu_memory_segment_get(__pyx_v__mem)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "pylibemu.pyx":1191 + /* "pylibemu.pyx":1198 * emu_memory_segment_select(_mem, segment) * * def memory_segment_get(self): # <<<<<<<<<<<<<< @@ -10067,7 +10114,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_74memory_segment_get(struct __pyx_ return __pyx_r; } -/* "pylibemu.pyx":1215 +/* "pylibemu.pyx":1222 * * # Win32 environment * def env_w32_hook_check(self): # <<<<<<<<<<<<<< @@ -10100,7 +10147,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("env_w32_hook_check", 0); - /* "pylibemu.pyx":1228 + /* "pylibemu.pyx":1235 * cdef c_emu_env *_env * * if self._emu is NULL: # <<<<<<<<<<<<<< @@ -10110,21 +10157,21 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ __pyx_t_1 = ((__pyx_v_self->_emu == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1229 + /* "pylibemu.pyx":1236 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _env = emu_env_new(self._emu) */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__38, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1231 + /* "pylibemu.pyx":1238 * raise RuntimeError('Emulator not initialized') * * _env = emu_env_new(self._emu) # <<<<<<<<<<<<<< @@ -10133,7 +10180,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ */ __pyx_v__env = emu_env_new(__pyx_v_self->_emu); - /* "pylibemu.pyx":1232 + /* "pylibemu.pyx":1239 * * _env = emu_env_new(self._emu) * if _env is NULL: # <<<<<<<<<<<<<< @@ -10143,33 +10190,33 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ __pyx_t_1 = ((__pyx_v__env == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1233 + /* "pylibemu.pyx":1240 * _env = emu_env_new(self._emu) * if _env is NULL: * print emu_strerror(self._emu) # <<<<<<<<<<<<<< * raise RuntimeError('Emulator environment error') * */ - __pyx_t_2 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBytes_FromString(emu_strerror(__pyx_v_self->_emu)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_PrintOne(0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PrintOne(0, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "pylibemu.pyx":1234 + /* "pylibemu.pyx":1241 * if _env is NULL: * print emu_strerror(self._emu) * raise RuntimeError('Emulator environment error') # <<<<<<<<<<<<<< * * if emu_env_w32_eip_check(_env) is NULL: */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__39, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_Raise(__pyx_t_2, 0, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "pylibemu.pyx":1236 + /* "pylibemu.pyx":1243 * raise RuntimeError('Emulator environment error') * * if emu_env_w32_eip_check(_env) is NULL: # <<<<<<<<<<<<<< @@ -10179,7 +10226,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ __pyx_t_1 = ((emu_env_w32_eip_check(__pyx_v__env) == NULL) != 0); if (__pyx_t_1) { - /* "pylibemu.pyx":1237 + /* "pylibemu.pyx":1244 * * if emu_env_w32_eip_check(_env) is NULL: * emu_env_free(_env) # <<<<<<<<<<<<<< @@ -10188,7 +10235,7 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ */ emu_env_free(__pyx_v__env); - /* "pylibemu.pyx":1238 + /* "pylibemu.pyx":1245 * if emu_env_w32_eip_check(_env) is NULL: * emu_env_free(_env) * return False # <<<<<<<<<<<<<< @@ -10201,25 +10248,27 @@ static PyObject *__pyx_pf_8pylibemu_8Emulator_76env_w32_hook_check(struct __pyx_ goto __pyx_L0; } - /* "pylibemu.pyx":1240 + /* "pylibemu.pyx":1247 * return False * * emu_env_free(_env) # <<<<<<<<<<<<<< * return True + * */ emu_env_free(__pyx_v__env); - /* "pylibemu.pyx":1241 + /* "pylibemu.pyx":1248 * * emu_env_free(_env) * return True # <<<<<<<<<<<<<< + * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(Py_True); __pyx_r = Py_True; goto __pyx_L0; - /* "pylibemu.pyx":1215 + /* "pylibemu.pyx":1222 * * # Win32 environment * def env_w32_hook_check(self): # <<<<<<<<<<<<<< @@ -10966,58 +11015,58 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__34); __Pyx_GIVEREF(__pyx_tuple__34); - /* "pylibemu.pyx":1160 + /* "pylibemu.pyx":1163 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__35); __Pyx_GIVEREF(__pyx_tuple__35); - /* "pylibemu.pyx":1186 + /* "pylibemu.pyx":1193 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__36 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__36); __Pyx_GIVEREF(__pyx_tuple__36); - /* "pylibemu.pyx":1209 + /* "pylibemu.pyx":1216 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _mem = emu_memory_get(self._emu) */ - __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__37 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__37); __Pyx_GIVEREF(__pyx_tuple__37); - /* "pylibemu.pyx":1229 + /* "pylibemu.pyx":1236 * * if self._emu is NULL: * raise RuntimeError('Emulator not initialized') # <<<<<<<<<<<<<< * * _env = emu_env_new(self._emu) */ - __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__38 = PyTuple_Pack(1, __pyx_kp_s_Emulator_not_initialized); if (unlikely(!__pyx_tuple__38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__38); __Pyx_GIVEREF(__pyx_tuple__38); - /* "pylibemu.pyx":1234 + /* "pylibemu.pyx":1241 * if _env is NULL: * print emu_strerror(self._emu) * raise RuntimeError('Emulator environment error') # <<<<<<<<<<<<<< * * if emu_env_w32_eip_check(_env) is NULL: */ - __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_Emulator_environment_error); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__39 = PyTuple_Pack(1, __pyx_kp_s_Emulator_environment_error); if (unlikely(!__pyx_tuple__39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__39); __Pyx_GIVEREF(__pyx_tuple__39); __Pyx_RefNannyFinishContext(); diff --git a/src/pylibemu.pyx b/src/pylibemu.pyx index 20cbcbf..97f93c6 100644 --- a/src/pylibemu.pyx +++ b/src/pylibemu.pyx @@ -1136,7 +1136,10 @@ cdef class Emulator: if emu_memory_read_block(_mem, addr, block, _len): raise RuntimeError("Error while reading a dword at address 0x%x" % (addr, )) - return block + data = (block) + free(block) + + return data def memory_read_string(self, uint32_t addr, uint32_t maxsize): ''' @@ -1161,9 +1164,13 @@ cdef class Emulator: _mem = emu_memory_get(self._emu) if emu_memory_read_string(_mem, addr, &s, maxsize): + free(s.data) raise RuntimeError("Error while reading a string at address 0x%x" % (addr, )) - return s.data + data = (s.data) + free(s.data) + + return data def memory_segment_select(self, c_emu_segment segment): ''' @@ -1239,3 +1246,4 @@ cdef class Emulator: emu_env_free(_env) return True +