Make it possible to compile with mypyc for approximately 50% speedup.
This commit is contained in:
parent
862af2d42b
commit
6ff267ee7c
|
@ -1,4 +1,5 @@
|
|||
from typing import List, Optional, Tuple, cast
|
||||
from typing_extensions import Final
|
||||
|
||||
|
||||
class BinaryException(Exception):
|
||||
|
@ -7,7 +8,7 @@ class BinaryException(Exception):
|
|||
|
||||
class Binary:
|
||||
|
||||
CHUNK_SIZE = 1024
|
||||
CHUNK_SIZE: Final[int] = 1024
|
||||
|
||||
@staticmethod
|
||||
def _hex(val: int) -> str:
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
import struct
|
||||
from typing_extensions import Final
|
||||
|
||||
from lzss import LZSSDecompressor, LZSSFakeCompressor
|
||||
|
||||
|
||||
class FirebeatExe:
|
||||
|
||||
PPP_LOAD_OFFSET: int = 0x80000000
|
||||
PPP_IMAGE_HEADER: bytes = b"\x21\x3a\x45\x58\x45\x3a\x30\x30"
|
||||
PPP_IMAGE_FOOTER: bytes = b"\x21\x3a\x45\x58\x45\x3a\x30\x30"
|
||||
PPP_LOAD_OFFSET: Final[int] = 0x80000000
|
||||
PPP_IMAGE_HEADER: Final[bytes] = b"\x21\x3a\x45\x58\x45\x3a\x30\x30"
|
||||
PPP_IMAGE_FOOTER: Final[bytes] = b"\x21\x3a\x45\x58\x45\x3a\x30\x30"
|
||||
|
||||
@staticmethod
|
||||
def __simple_exe_to_raw(data: bytes) -> bytes:
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
from typing import Generator, List, Optional
|
||||
from typing_extensions import Final
|
||||
|
||||
|
||||
class LZSSDecompressor:
|
||||
WINDOW_LENGTH = 0x1000
|
||||
WINDOW_LENGTH: Final[int] = 0x1000
|
||||
|
||||
FLAG_COPY = 1
|
||||
FLAG_BACKREF = 0
|
||||
FLAG_COPY: Final[int] = 1
|
||||
FLAG_BACKREF: Final[int] = 0
|
||||
|
||||
def __init__(self, data: bytes) -> None:
|
||||
self.__decompressed: Optional[bytes] = None
|
||||
|
@ -94,7 +95,7 @@ class LZSSDecompressor:
|
|||
|
||||
|
||||
class LZSSFakeCompressor:
|
||||
WINDOW_LENGTH = 0x1000
|
||||
WINDOW_LENGTH: Final[int] = 0x1000
|
||||
|
||||
def __init__(self, data: bytes) -> None:
|
||||
self.__compressed: Optional[bytes] = None
|
||||
|
|
Loading…
Reference in New Issue