Example #1
0
class RevertableList(magic.FakeStrict, list):
    __module__ = "renpy.python"

    def __new__(cls):
        return list.__new__(cls)


class RevertableDict(magic.FakeStrict, dict):
    __module__ = "renpy.python"

    def __new__(cls):
        return dict.__new__(cls)


class_factory = magic.FakeClassFactory(
    (PyExpr, PyCode, RevertableList, RevertableDict), magic.FakeStrict)

# API


def read_ast_from_file(in_file):
    # .rpyc files are just zlib compressed pickles of a tuple of some data and the actual AST of the file
    raw_contents = in_file.read()
    if raw_contents.startswith("RENPY RPC2"):
        # parse the archive structure
        position = 10
        chunks = {}
        while True:
            slot, start, length = struct.unpack(
                "III", raw_contents[position:position + 12])
            if slot == 0:
Example #2
0
        self.linenumber = linenumber
        return self

    def __getnewargs__(self):
        return unicode(self), self.filename, self.linenumber


class PyCode(magic.FakeStrict):
    __module__ = "renpy.ast"

    def __setstate__(self, state):
        (_, self.source, self.location, self.mode) = state
        self.bytecode = None


class_factory = magic.FakeClassFactory((PyExpr, PyCode), magic.FakeStrict)

printlock = Lock()

# API


def read_ast_from_file(in_file):
    # .rpyc files are just zlib compressed pickles of a tuple of some data and the actual AST of the file
    raw_contents = in_file.read()
    if raw_contents.startswith("RENPY RPC2"):
        # parse the archive structure
        position = 10
        chunks = {}
        while True:
            slot, start, length = struct.unpack(
Example #3
0
            language = "english"
        else:
            rv = self._cases.get(language + "_" + name)

        if rv is not None:
            return rv
        elif config.developer:
            raise AttributeError("LanguageCases have not defined "
                                 "'{}' case for language '{}'".format(
                                     name, language))
        else:
            return __(self)


class_factory = magic.FakeClassFactory(
    (PyExpr, PyCode, RevertableList, RevertableDict, RevertableSet, Sentinel,
     RevertableList, _ELSE_COND, LanguageCases), magic.FakeStrict)

printlock = Lock()

# needs class_factory
import deobfuscate

# API


def read_ast_from_file(in_file):
    # .rpyc files are just zlib compressed pickles of a tuple of some data and the actual AST of the file
    raw_contents = in_file.read()
    if raw_contents.startswith("RENPY RPC2"):
        # parse the archive structure