tiptoi-tools 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tiptoi_tools-0.1.0/LICENSE +21 -0
- tiptoi_tools-0.1.0/PKG-INFO +72 -0
- tiptoi_tools-0.1.0/README.md +46 -0
- tiptoi_tools-0.1.0/pyproject.toml +59 -0
- tiptoi_tools-0.1.0/setup.cfg +4 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/__init__.py +0 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/__main__.py +10 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/audio.py +63 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/binary.py +169 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/command_line.py +968 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/games.py +695 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/gme.py +681 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/media.py +184 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/playlist.py +121 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools/scripts.py +903 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools.egg-info/PKG-INFO +72 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools.egg-info/SOURCES.txt +19 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools.egg-info/dependency_links.txt +1 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools.egg-info/entry_points.txt +2 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools.egg-info/requires.txt +6 -0
- tiptoi_tools-0.1.0/src/tiptoi_tools.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Jeremy Retailleau
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tiptoi-tools
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Tiptoi GME inspection and extraction tools.
|
|
5
|
+
Author-email: Jeremy Retailleau <jeremy.retailleau@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/buddly27/tiptoi-tools
|
|
8
|
+
Project-URL: Changelog, https://github.com/buddly27/tiptoi-tools/blob/main/CHANGELOG.md
|
|
9
|
+
Project-URL: Issues, https://github.com/buddly27/tiptoi-tools/issues
|
|
10
|
+
Keywords: tiptoi,gme,cli
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
16
|
+
Classifier: Topic :: Utilities
|
|
17
|
+
Requires-Python: >=3.10
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: click<9,>=8.3.1
|
|
21
|
+
Requires-Dist: PyYAML<7,>=6.0.3
|
|
22
|
+
Requires-Dist: miniaudio<2,>=1.60
|
|
23
|
+
Provides-Extra: dev
|
|
24
|
+
Requires-Dist: ruff>=0.14.0; extra == "dev"
|
|
25
|
+
Dynamic: license-file
|
|
26
|
+
|
|
27
|
+
# tiptoi-tools
|
|
28
|
+
|
|
29
|
+
Python CLI for inspecting, extracting, and building Ravensburger Tiptoi GME files.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install tiptoi-tools
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Show file information
|
|
41
|
+
tiptoi-tools file.gme info
|
|
42
|
+
|
|
43
|
+
# Export to YAML and media files
|
|
44
|
+
tiptoi-tools file.gme export
|
|
45
|
+
|
|
46
|
+
# Build GME from YAML
|
|
47
|
+
tiptoi-tools file.yaml build
|
|
48
|
+
|
|
49
|
+
# Play audio by OID or media index
|
|
50
|
+
tiptoi-tools file.gme play 123
|
|
51
|
+
tiptoi-tools file.gme play @456
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Commands
|
|
55
|
+
|
|
56
|
+
| Command | Description |
|
|
57
|
+
|---------|-------------|
|
|
58
|
+
| `info` | Show GME file metadata and structure |
|
|
59
|
+
| `export` | Export to YAML with media files |
|
|
60
|
+
| `build` | Build GME from tttool-compatible YAML |
|
|
61
|
+
| `play` | Play audio by OID or media index |
|
|
62
|
+
| `scripts` | Browse and search scripts |
|
|
63
|
+
| `games` | List games and their structure |
|
|
64
|
+
| `oids` | Explore OID relationships |
|
|
65
|
+
|
|
66
|
+
## Acknowledgments
|
|
67
|
+
|
|
68
|
+
This project is inspired by and compatible with [tttool](https://github.com/entropia/tip-toi-reveng), the original Tiptoi reverse-engineering toolkit created by Joachim Breitner ([@nomeata](https://github.com/nomeata)). The GME file format documentation and YAML schema originate from the tttool project.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# tiptoi-tools
|
|
2
|
+
|
|
3
|
+
Python CLI for inspecting, extracting, and building Ravensburger Tiptoi GME files.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install tiptoi-tools
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Show file information
|
|
15
|
+
tiptoi-tools file.gme info
|
|
16
|
+
|
|
17
|
+
# Export to YAML and media files
|
|
18
|
+
tiptoi-tools file.gme export
|
|
19
|
+
|
|
20
|
+
# Build GME from YAML
|
|
21
|
+
tiptoi-tools file.yaml build
|
|
22
|
+
|
|
23
|
+
# Play audio by OID or media index
|
|
24
|
+
tiptoi-tools file.gme play 123
|
|
25
|
+
tiptoi-tools file.gme play @456
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Commands
|
|
29
|
+
|
|
30
|
+
| Command | Description |
|
|
31
|
+
|---------|-------------|
|
|
32
|
+
| `info` | Show GME file metadata and structure |
|
|
33
|
+
| `export` | Export to YAML with media files |
|
|
34
|
+
| `build` | Build GME from tttool-compatible YAML |
|
|
35
|
+
| `play` | Play audio by OID or media index |
|
|
36
|
+
| `scripts` | Browse and search scripts |
|
|
37
|
+
| `games` | List games and their structure |
|
|
38
|
+
| `oids` | Explore OID relationships |
|
|
39
|
+
|
|
40
|
+
## Acknowledgments
|
|
41
|
+
|
|
42
|
+
This project is inspired by and compatible with [tttool](https://github.com/entropia/tip-toi-reveng), the original Tiptoi reverse-engineering toolkit created by Joachim Breitner ([@nomeata](https://github.com/nomeata)). The GME file format documentation and YAML schema originate from the tttool project.
|
|
43
|
+
|
|
44
|
+
## License
|
|
45
|
+
|
|
46
|
+
MIT
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "tiptoi-tools"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Tiptoi GME inspection and extraction tools."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
keywords = ["tiptoi", "gme", "cli"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Jeremy Retailleau", email = "jeremy.retailleau@gmail.com" }
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"click>=8.3.1,<9",
|
|
18
|
+
"PyYAML>=6.0.3,<7",
|
|
19
|
+
"miniaudio>=1.60,<2",
|
|
20
|
+
]
|
|
21
|
+
classifiers = [
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
24
|
+
"Environment :: Console",
|
|
25
|
+
"Intended Audience :: Developers",
|
|
26
|
+
"Topic :: Multimedia :: Sound/Audio",
|
|
27
|
+
"Topic :: Utilities",
|
|
28
|
+
]
|
|
29
|
+
|
|
30
|
+
[project.scripts]
|
|
31
|
+
tiptoi-tools = "tiptoi_tools.__main__:main"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Repository = "https://github.com/buddly27/tiptoi-tools"
|
|
35
|
+
Changelog = "https://github.com/buddly27/tiptoi-tools/blob/main/CHANGELOG.md"
|
|
36
|
+
Issues = "https://github.com/buddly27/tiptoi-tools/issues"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
dev = [
|
|
40
|
+
"ruff>=0.14.0",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
[tool.setuptools]
|
|
44
|
+
package-dir = {"" = "src"}
|
|
45
|
+
|
|
46
|
+
[tool.setuptools.packages.find]
|
|
47
|
+
where = ["src"]
|
|
48
|
+
|
|
49
|
+
[tool.ruff]
|
|
50
|
+
target-version = "py310"
|
|
51
|
+
line-length = 88
|
|
52
|
+
src = ["src"]
|
|
53
|
+
|
|
54
|
+
[tool.ruff.lint]
|
|
55
|
+
select = ["E", "F", "I", "B", "UP"]
|
|
56
|
+
fixable = ["ALL"]
|
|
57
|
+
|
|
58
|
+
[tool.ruff.format]
|
|
59
|
+
skip-magic-trailing-comma = false
|
|
File without changes
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import time
|
|
2
|
+
|
|
3
|
+
import miniaudio
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class AudioPlaybackError(Exception):
|
|
7
|
+
"""Raised when audio playback fails."""
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def play_audio(data: bytes, verbose: bool = False) -> None:
|
|
11
|
+
"""
|
|
12
|
+
Play audio data using miniaudio.
|
|
13
|
+
|
|
14
|
+
Args:
|
|
15
|
+
data: Raw audio bytes (decrypted)
|
|
16
|
+
verbose: If True, show additional playback info
|
|
17
|
+
|
|
18
|
+
Raises:
|
|
19
|
+
AudioPlaybackError: If playback fails
|
|
20
|
+
"""
|
|
21
|
+
try:
|
|
22
|
+
# Decode audio - miniaudio auto-detects format
|
|
23
|
+
decoded = miniaudio.decode(data, output_format=miniaudio.SampleFormat.SIGNED16)
|
|
24
|
+
|
|
25
|
+
duration = decoded.num_frames / decoded.sample_rate
|
|
26
|
+
|
|
27
|
+
if verbose:
|
|
28
|
+
print(
|
|
29
|
+
f" Audio: {decoded.sample_rate}Hz, "
|
|
30
|
+
f"{decoded.nchannels}ch, {duration:.2f}s"
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
# Start playback device
|
|
34
|
+
device = miniaudio.PlaybackDevice(
|
|
35
|
+
output_format=miniaudio.SampleFormat.SIGNED16,
|
|
36
|
+
nchannels=decoded.nchannels,
|
|
37
|
+
sample_rate=decoded.sample_rate,
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# Use stream_memory for proper playback
|
|
41
|
+
stream = miniaudio.stream_memory(
|
|
42
|
+
data,
|
|
43
|
+
output_format=miniaudio.SampleFormat.SIGNED16,
|
|
44
|
+
nchannels=decoded.nchannels,
|
|
45
|
+
sample_rate=decoded.sample_rate,
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
device.start(stream)
|
|
49
|
+
|
|
50
|
+
# Wait for playback to complete
|
|
51
|
+
time.sleep(duration + 0.2)
|
|
52
|
+
device.close()
|
|
53
|
+
|
|
54
|
+
except miniaudio.DecodeError as e:
|
|
55
|
+
raise AudioPlaybackError(f"Failed to decode audio: {e}") from None
|
|
56
|
+
except miniaudio.MiniaudioError as e:
|
|
57
|
+
raise AudioPlaybackError(f"Playback error: {e}") from None
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def get_player_info() -> str:
|
|
61
|
+
"""Return information about the audio backend."""
|
|
62
|
+
backends = miniaudio.get_enabled_backends()
|
|
63
|
+
return f"miniaudio (backends: {', '.join(b.name for b in backends)})"
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import struct
|
|
2
|
+
from typing import TypeAlias
|
|
3
|
+
|
|
4
|
+
OID: TypeAlias = int
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def u8(data: bytes, offset: int) -> int:
|
|
8
|
+
"""Read an unsigned 8-bit integer."""
|
|
9
|
+
return data[offset]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def u16le(data: bytes, offset: int) -> int:
|
|
13
|
+
"""Read a little-endian unsigned 16-bit integer."""
|
|
14
|
+
return struct.unpack_from("<H", data, offset)[0]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def u32le(data: bytes, offset: int) -> int:
|
|
18
|
+
"""Read a little-endian unsigned 32-bit integer."""
|
|
19
|
+
return struct.unpack_from("<I", data, offset)[0]
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def pack_u8(value: int) -> bytes:
|
|
23
|
+
"""Pack an unsigned 8-bit integer to bytes."""
|
|
24
|
+
return bytes([value & 0xFF])
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def pack_u16le(value: int) -> bytes:
|
|
28
|
+
"""Pack a little-endian unsigned 16-bit integer to bytes."""
|
|
29
|
+
return struct.pack("<H", value)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def lo_u8(n: int) -> int:
|
|
33
|
+
"""Extract the low byte of a 16-bit value."""
|
|
34
|
+
return n & 0xFF
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
def hi_u8(n: int) -> int:
|
|
38
|
+
"""Extract the high byte of a 16-bit value."""
|
|
39
|
+
return (n >> 8) & 0xFF
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def ascii_clean(b: bytes) -> str:
|
|
43
|
+
"""Decode bytes as ASCII, replacing invalid characters."""
|
|
44
|
+
return b.decode("ascii", errors="replace")
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class BinaryReader:
|
|
48
|
+
"""Sequential reader for binary data with automatic offset tracking."""
|
|
49
|
+
|
|
50
|
+
def __init__(self, data: bytes, offset: int = 0):
|
|
51
|
+
self.data = data
|
|
52
|
+
self.offset = offset
|
|
53
|
+
|
|
54
|
+
def u8(self) -> int:
|
|
55
|
+
"""Read an unsigned 8-bit integer."""
|
|
56
|
+
v = self.data[self.offset]
|
|
57
|
+
self.offset += 1
|
|
58
|
+
return v
|
|
59
|
+
|
|
60
|
+
def u16(self) -> int:
|
|
61
|
+
"""Read a little-endian unsigned 16-bit integer."""
|
|
62
|
+
v = u16le(self.data, self.offset)
|
|
63
|
+
self.offset += 2
|
|
64
|
+
return v
|
|
65
|
+
|
|
66
|
+
def u32(self) -> int:
|
|
67
|
+
"""Read a little-endian unsigned 32-bit integer."""
|
|
68
|
+
v = u32le(self.data, self.offset)
|
|
69
|
+
self.offset += 4
|
|
70
|
+
return v
|
|
71
|
+
|
|
72
|
+
def bytes(self, n: int) -> bytes:
|
|
73
|
+
"""Read n raw bytes."""
|
|
74
|
+
v = self.data[self.offset : self.offset + n]
|
|
75
|
+
self.offset += n
|
|
76
|
+
return v
|
|
77
|
+
|
|
78
|
+
def u16_array(self, count: int) -> list[int]:
|
|
79
|
+
"""Read an array of u16 values."""
|
|
80
|
+
values = [u16le(self.data, self.offset + i * 2) for i in range(count)]
|
|
81
|
+
self.offset += count * 2
|
|
82
|
+
return values
|
|
83
|
+
|
|
84
|
+
def u32_array(self, count: int) -> list[int]:
|
|
85
|
+
"""Read an array of u32 values."""
|
|
86
|
+
values = [u32le(self.data, self.offset + i * 4) for i in range(count)]
|
|
87
|
+
self.offset += count * 4
|
|
88
|
+
return values
|
|
89
|
+
|
|
90
|
+
def u16_list(self) -> list[int]:
|
|
91
|
+
"""Read a length-prefixed list of u16 values."""
|
|
92
|
+
n = self.u16()
|
|
93
|
+
return self.u16_array(n)
|
|
94
|
+
|
|
95
|
+
def at(self, offset: int) -> "BinaryReader":
|
|
96
|
+
"""Create a new reader at the given absolute offset."""
|
|
97
|
+
return BinaryReader(self.data, offset)
|
|
98
|
+
|
|
99
|
+
def skip(self, n: int) -> None:
|
|
100
|
+
"""Skip n bytes."""
|
|
101
|
+
self.offset += n
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class BinaryWriter:
|
|
105
|
+
"""Sequential writer for binary data with automatic offset tracking."""
|
|
106
|
+
|
|
107
|
+
def __init__(self):
|
|
108
|
+
self._data = bytearray()
|
|
109
|
+
|
|
110
|
+
@property
|
|
111
|
+
def offset(self) -> int:
|
|
112
|
+
"""Current write position."""
|
|
113
|
+
return len(self._data)
|
|
114
|
+
|
|
115
|
+
def u8(self, value: int) -> None:
|
|
116
|
+
"""Write an unsigned 8-bit integer."""
|
|
117
|
+
self._data.append(value & 0xFF)
|
|
118
|
+
|
|
119
|
+
def u16(self, value: int) -> None:
|
|
120
|
+
"""Write a little-endian unsigned 16-bit integer."""
|
|
121
|
+
self._data.extend(struct.pack("<H", value))
|
|
122
|
+
|
|
123
|
+
def u32(self, value: int) -> None:
|
|
124
|
+
"""Write a little-endian unsigned 32-bit integer."""
|
|
125
|
+
self._data.extend(struct.pack("<I", value))
|
|
126
|
+
|
|
127
|
+
def bytes(self, data: bytes) -> None:
|
|
128
|
+
"""Write raw bytes."""
|
|
129
|
+
self._data.extend(data)
|
|
130
|
+
|
|
131
|
+
def u16_array(self, values: list[int]) -> None:
|
|
132
|
+
"""Write an array of u16 values."""
|
|
133
|
+
for v in values:
|
|
134
|
+
self.u16(v)
|
|
135
|
+
|
|
136
|
+
def u32_array(self, values: list[int]) -> None:
|
|
137
|
+
"""Write an array of u32 values."""
|
|
138
|
+
for v in values:
|
|
139
|
+
self.u32(v)
|
|
140
|
+
|
|
141
|
+
def u16_list(self, values: list[int]) -> None:
|
|
142
|
+
"""Write a length-prefixed list of u16 values."""
|
|
143
|
+
self.u16(len(values))
|
|
144
|
+
self.u16_array(values)
|
|
145
|
+
|
|
146
|
+
def pad_to(self, target: int) -> None:
|
|
147
|
+
"""Pad with zeros to reach target offset."""
|
|
148
|
+
if self.offset < target:
|
|
149
|
+
self._data.extend(b"\x00" * (target - self.offset))
|
|
150
|
+
|
|
151
|
+
def u8_at(self, offset: int, value: int) -> None:
|
|
152
|
+
"""Patch a u8 at a specific offset."""
|
|
153
|
+
self._data[offset] = value & 0xFF
|
|
154
|
+
|
|
155
|
+
def u16_at(self, offset: int, value: int) -> None:
|
|
156
|
+
"""Patch a u16 at a specific offset."""
|
|
157
|
+
self._data[offset : offset + 2] = struct.pack("<H", value)
|
|
158
|
+
|
|
159
|
+
def u32_at(self, offset: int, value: int) -> None:
|
|
160
|
+
"""Patch a u32 at a specific offset."""
|
|
161
|
+
self._data[offset : offset + 4] = struct.pack("<I", value)
|
|
162
|
+
|
|
163
|
+
def bytes_at(self, offset: int, data: bytes) -> None:
|
|
164
|
+
"""Patch bytes at a specific offset."""
|
|
165
|
+
self._data[offset : offset + len(data)] = data
|
|
166
|
+
|
|
167
|
+
def to_bytes(self) -> bytes:
|
|
168
|
+
"""Return the written data as bytes."""
|
|
169
|
+
return bytes(self._data)
|