Обновление структуры проекта, использование pydantic для конфигураций, улучшение отчёта о патчах
Build mod / build (push) Successful in 6m39s
Build mod / build (push) Successful in 6m39s
This commit is contained in:
@@ -10,19 +10,28 @@
|
||||
priority = 0
|
||||
|
||||
# imports
|
||||
from tqdm import tqdm
|
||||
from typing import Dict, List, Any
|
||||
from pydantic import Field
|
||||
|
||||
from utils.config import PatchConfig
|
||||
from utils.smali_parser import float_to_hex
|
||||
from utils.public import (
|
||||
insert_after_public,
|
||||
insert_after_id,
|
||||
)
|
||||
|
||||
#Config
|
||||
class Config(PatchConfig):
|
||||
speeds: List[float] = Field([9.0], description="Список пользовательских скоростей воспроизведения")
|
||||
|
||||
|
||||
# Patch
|
||||
def apply(config: dict) -> bool:
|
||||
def apply(config: Config, base: Dict[str, Any]) -> bool:
|
||||
assert float_to_hex(1.5) == "0x3fc00000"
|
||||
|
||||
last = "speed75"
|
||||
for speed in config.get("speeds", []):
|
||||
for speed in config.speeds:
|
||||
insert_after_public(last, f"speed{int(float(speed)*10)}")
|
||||
insert_after_id(last, f"speed{int(float(speed)*10)}")
|
||||
last = f"speed{int(float(speed)*10)}"
|
||||
|
||||
Reference in New Issue
Block a user