From 3d62b9d3728d5d1fac4b49306ff57c1cde0ac7b1 Mon Sep 17 00:00:00 2001 From: Kevin Trocolli Date: Thu, 9 Nov 2023 22:36:33 -0500 Subject: [PATCH] sao: add SaoResponseHeader --- titles/sao/handlers/base.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/titles/sao/handlers/base.py b/titles/sao/handlers/base.py index 579e2c8..3579a9e 100644 --- a/titles/sao/handlers/base.py +++ b/titles/sao/handlers/base.py @@ -22,7 +22,7 @@ class SaoBaseRequest: logging.getLogger('sao').error(f"Expected {self.header.data_len} data bytes byt got {len(data)}!") # TODO: Raise an error here -class SaoBaseResponse: +class SaoResponseHeader: def __init__(self, cmd_id: int) -> None: self.cmd = cmd_id self.err_status = 0 @@ -35,6 +35,13 @@ class SaoBaseResponse: def make(self) -> bytes: return struct.pack("!HHIIIII", self.cmd, self.err_status, self.error_type, self.vendor_id, self.game_id, self.version_id, self.length) +class SaoBaseResponse: + def __init__(self, cmd_id: int) -> None: + self.header = SaoResponseHeader(cmd_id) + + def make(self) -> bytes: + return self.header.make() + class SaoNoopResponse(SaoBaseResponse): def __init__(self, cmd: int) -> None: super().__init__(cmd)