From 26c4bcb466555910fa0832906163816b1c28dea2 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Sun, 23 Apr 2023 13:26:44 -0400 Subject: [PATCH] idz: Add requests, fix load_config_b --- titles/idz/handlers/__init__.py | 8 ++++++++ titles/idz/handlers/load_config.py | 2 +- titles/idz/handlers/save_time_attack.py | 22 ++++++++++++++++++++++ titles/idz/handlers/unlock_profile.py | 20 ++++++++++++++++++++ titles/idz/handlers/update_team_points.py | 17 +++++++++++++++++ titles/idz/handlers/update_ui_report.py | 17 +++++++++++++++++ titles/idz/handlers/update_user_log.py | 17 +++++++++++++++++ 7 files changed, 102 insertions(+), 1 deletion(-) create mode 100644 titles/idz/handlers/save_time_attack.py create mode 100644 titles/idz/handlers/unlock_profile.py create mode 100644 titles/idz/handlers/update_team_points.py create mode 100644 titles/idz/handlers/update_ui_report.py create mode 100644 titles/idz/handlers/update_user_log.py diff --git a/titles/idz/handlers/__init__.py b/titles/idz/handlers/__init__.py index a3cc248..17213ba 100644 --- a/titles/idz/handlers/__init__.py +++ b/titles/idz/handlers/__init__.py @@ -37,3 +37,11 @@ from .update_provisional_store_rank import IDZHandlerUpdateProvisionalStoreRank from .load_reward_table import IDZHandlerLoadRewardTable from .save_topic import IDZHandlerSaveTopic + +from .save_time_attack import IDZHandlerSaveTimeAttack + +from .unlock_profile import IDZHandlerUnlockProfile + +from .update_team_points import IDZHandleUpdateTeamPoints + +from .update_ui_report import IDZHandleUpdateUIReport diff --git a/titles/idz/handlers/load_config.py b/titles/idz/handlers/load_config.py index fa103af..3ae57f5 100644 --- a/titles/idz/handlers/load_config.py +++ b/titles/idz/handlers/load_config.py @@ -24,7 +24,7 @@ class IDZHandlerLoadConfigA(IDZHandlerBase): return ret class IDZHandlerLoadConfigB(IDZHandlerBase): - cmd_codes = [0x00a0] * IDZConstants.NUM_VERS + cmd_codes = [0x00ab, 0x00ab, 0x00a0, 0x00a0] rsp_codes = [0x00ac, 0x00ac, 0x00a1, 0x00a1] name = "load_config_b" diff --git a/titles/idz/handlers/save_time_attack.py b/titles/idz/handlers/save_time_attack.py new file mode 100644 index 0000000..a28a598 --- /dev/null +++ b/titles/idz/handlers/save_time_attack.py @@ -0,0 +1,22 @@ +import struct + +from .base import IDZHandlerBase +from core.config import CoreConfig +from ..config import IDZConfig +from ..const import IDZConstants + +class IDZHandlerSaveTimeAttack(IDZHandlerBase): + cmd_codes = [0x00CD, 0x0136, 0x0136, 0x0136] + rsp_codes = [0x00ce, 0x00ce, 0x00cd, 0x00cd] + name = "save_time_attack" + + def __init__(self, core_cfg: CoreConfig, game_cfg: IDZConfig, version: int) -> None: + super().__init__(core_cfg, game_cfg, version) + self.size = 0x00b0 + + if self.version > IDZConstants.VER_IDZ_130: + self.size = 0x00f0 + + def handle(self, data: bytes) -> bytearray: + ret = super().handle(data) + return ret \ No newline at end of file diff --git a/titles/idz/handlers/unlock_profile.py b/titles/idz/handlers/unlock_profile.py new file mode 100644 index 0000000..a5c8310 --- /dev/null +++ b/titles/idz/handlers/unlock_profile.py @@ -0,0 +1,20 @@ +import struct + +from .base import IDZHandlerBase +from core.config import CoreConfig +from ..config import IDZConfig +from ..const import IDZConstants + +class IDZHandlerUnlockProfile(IDZHandlerBase): + cmd_codes = [0x006f, 0x006f, 0x006b, 0x006b] + rsp_codes = [0x0070, 0x0070, 0x006c, 0x006c] + name = "unlock_profile" + + def __init__(self, core_cfg: CoreConfig, game_cfg: IDZConfig, version: int) -> None: + super().__init__(core_cfg, game_cfg, version) + self.size = 0x0010 + + def handle(self, data: bytes) -> bytearray: + ret = super().handle(data) + struct.pack_into(" None: + super().__init__(core_cfg, game_cfg, version) + + def handle(self, data: bytes) -> bytearray: + ret = super().handle(data) + return ret diff --git a/titles/idz/handlers/update_ui_report.py b/titles/idz/handlers/update_ui_report.py new file mode 100644 index 0000000..b77b4ea --- /dev/null +++ b/titles/idz/handlers/update_ui_report.py @@ -0,0 +1,17 @@ +import struct + +from .base import IDZHandlerBase +from core.config import CoreConfig +from ..config import IDZConfig +from ..const import IDZConstants + +class IDZHandleUpdateUIReport(IDZHandlerBase): + cmd_codes = [0x0084, 0x0084, 0x007e, 0x007e] + name = "update_ui_report" + + def __init__(self, core_cfg: CoreConfig, game_cfg: IDZConfig, version: int) -> None: + super().__init__(core_cfg, game_cfg, version) + + def handle(self, data: bytes) -> bytearray: + ret = super().handle(data) + return ret diff --git a/titles/idz/handlers/update_user_log.py b/titles/idz/handlers/update_user_log.py new file mode 100644 index 0000000..78679eb --- /dev/null +++ b/titles/idz/handlers/update_user_log.py @@ -0,0 +1,17 @@ +import struct + +from .base import IDZHandlerBase +from core.config import CoreConfig +from ..config import IDZConfig +from ..const import IDZConstants + +class IDZHandleUpdateUserLog(IDZHandlerBase): + cmd_codes = [0x00bd, 0x00bd, 0x00ab, 0x00b3] + name = "update_user_log" + + def __init__(self, core_cfg: CoreConfig, game_cfg: IDZConfig, version: int) -> None: + super().__init__(core_cfg, game_cfg, version) + + def handle(self, data: bytes) -> bytearray: + ret = super().handle(data) + return ret