Exemplo n.º 1
0
Arquivo: version.py Projeto: ursi/sbpe
 def afterUpdate(self):
     menu = self.refs.MainMenu
     if menu == ffi.NULL or menu.version == ffi.NULL:
         return
     menu.version.asUIElement.show = False
     if len(self.vtxt.text) == 0:
         sbver = ffi.string(menu.version.text.s).decode()
         self.vtxt.text = VTEMPLATE.format(sbver, self.refs)
Exemplo n.º 2
0
def hook_LoadTextureFile(name, callback, userData):
    refs._tfname = ffi.string(name).decode()

    hook = lib.subhook_new(callback, lib.hook_textureCallback, 0)
    refs._orig_callback = ffi.cast('XDL_LoadTextureDoneCallback',
                                   lib.subhook_get_trampoline(hook))

    lib.subhook_install(hook)
    ORIGS['XDL_LoadTextureFile'](name, callback, userData)
    lib.subhook_remove(hook)
    lib.subhook_free(hook)
Exemplo n.º 3
0
Arquivo: util.py Projeto: ursi/sbpe
def getClassName(obj):
    '''
    class name of a C++ object (assuming gcc memory layout).
    doesn't demangle complicated names
    '''
    if obj == ffi.NULL:
        return 'NULL'

    # class pointer is always at [0]
    classptr = ffi.cast('void****', obj)[0]
    # vtable (1 up) -> type -> name (1 down)
    nameptr = classptr[-1][1]
    cname = ffi.string(ffi.cast('char*', nameptr), 100)
    return cname[1 if len(cname) < 11 else 2:].decode()
Exemplo n.º 4
0
Arquivo: util.py Projeto: ursi/sbpe
def getstr(stdstring):
    if stdstring == ffi.NULL:
        return '(NULL)'
    return ffi.string(stdstring.s, 1000).decode('utf-8', errors='replace')