Archive the prototype and map the hangar request flow

Archive the earlier backend, client, build, and patch definitions. Document
the stock login and profile requests required to reach the hangar, along
with the profile structure and the relevant configuration blocks.
This commit is contained in:
N0VAN0M4LY committed 2026-11-24 00:07:51 +08:00
1 parent e094131a7a
commit 65f9377f24
34 files changed
-1655

No files matched your search

@@ -1,27 +0,0 @@
"""Ways to find a patch site in an executable.
One method per module, each exposing `locate(image, spec) -> list[int]` returning the
RVAs it matched. A method never picks a winner among several matches; the caller
requires exactly one and refuses otherwise.
"""
from __future__ import annotations
from collections.abc import Callable, Mapping
from ..errors import DefinitionError
from . import signature
Locator = Callable[..., list[int]]
_METHODS: Mapping[str, Locator] = {
signature.METHOD: signature.locate,
}
def method(name: str) -> Locator:
if name not in _METHODS:
raise DefinitionError(f"unknown locate method {name!r}; known methods: {', '.join(sorted(_METHODS))}")
return _METHODS[name]
__all__ = ["Locator", "method", "signature"]
@@ -1,57 +0,0 @@
"""Find a patch site by scanning for a byte pattern with wildcards.
A pattern is a hex string where "??" stands for any byte, for example:
"41 57 41 56 48 81 ec ?? ?? ?? ??"
Wildcards cover the bytes that legitimately differ between builds: addresses inside
rip-relative operands and the targets of relative calls and jumps. What is left is the
shape of the code, which is what identifies the function across versions.
This module only matches patterns; it needs no disassembler, which is why it is the part
that runs on the player's machine. Patterns are generated once on the development side
(see authoring.py) and stored in the patch definition.
"""
from __future__ import annotations
import re
from ..errors import DefinitionError
METHOD = "signature"
WILDCARD = "??"
def locate(image, *, pattern: str, section: str = ".text", limit: int = 8, **_unused) -> list[int]:
"""RVAs in `section` where `pattern` matches, at most `limit` of them."""
expression = compile_pattern(pattern)
data = image.section_bytes(section)
base = image.section(section).rva
hits = []
for match in expression.finditer(data):
hits.append(base + match.start())
if len(hits) >= limit:
break
return hits
def compile_pattern(pattern: str) -> re.Pattern[bytes]:
return re.compile(b"".join(_token_to_regex(token) for token in _tokens(pattern)), re.DOTALL)
def pattern_length(pattern: str) -> int:
return len(_tokens(pattern))
def _tokens(pattern: str) -> list[str]:
tokens = pattern.split()
if not tokens:
raise DefinitionError("signature pattern is empty")
for token in tokens:
if token != WILDCARD and not re.fullmatch(r"[0-9a-fA-F]{2}", token):
raise DefinitionError(f"signature pattern token must be a hex byte or {WILDCARD!r}, got {token!r}")
return tokens
def _token_to_regex(token: str) -> bytes:
return b"." if token == WILDCARD else re.escape(bytes.fromhex(token))