Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions torappu/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@

from pydantic_settings import BaseSettings, SettingsConfigDict

from torappu.consts import MACOS, WINDOWS
from torappu.consts import BASE_DIR, MACOS, WINDOWS


def get_flatc_path():
if WINDOWS:
return Path("bin/flatc.exe")
return Path(BASE_DIR / "bin/flatc.exe")
elif MACOS:
return Path("bin/macos/flatc")
return Path(BASE_DIR / "bin/macos/flatc")
else:
return Path("bin/flatc")
return Path(BASE_DIR / "bin/flatc")


class Config(BaseSettings):
Expand Down
33 changes: 33 additions & 0 deletions torappu/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,36 @@ async def main(
continue

tg.start_soon(check_and_run_task, task(client), diff)


async def export_client(
version: Version,
prev: Version | None,
exclude: list[str],
include: list[str],
):
if prev == version:
logger.info("Version did not change, skipping running")
return

client = Client(version, prev, config)
try:
await client.init()
except Exception as e:
logger.opt(exception=e).error("Failed to init client")
return

diff = client.diff()
for priority in sorted(registry.keys()):
logger.info(f"Checking for tasks in priority {priority}...")

async with anyio.create_task_group() as tg:
for task in registry[priority]:
input_name = task.__name__
if (exclude and input_name in exclude) or (
include and input_name not in include
):
continue

tg.start_soon(check_and_run_task, task(client), diff)
return client
3 changes: 2 additions & 1 deletion torappu/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

from torappu.config import Config
from torappu.consts import (
BASE_DIR,
GAMEDATA_DIR,
HEADERS,
HG_CN_BASEURL,
Expand Down Expand Up @@ -224,7 +225,7 @@ def load_idx(self, idx_path: str, decoded_path: Path):
"--natural-utf8",
"--defaults-json",
"--raw-binary",
"assets/ResourceManifest.fbs",
str(Path(BASE_DIR / "assets/ResourceManifest.fbs")),
"--",
flatbuffer_data_path,
]
Expand Down