uppercut-rom-headers 1.0.0__py3-none-any.whl
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.
- uppercut_rom_headers/__init__.py +24 -0
- uppercut_rom_headers/__main__.py +5 -0
- uppercut_rom_headers/_checks.py +37 -0
- uppercut_rom_headers/cli.py +85 -0
- uppercut_rom_headers/gba.py +28 -0
- uppercut_rom_headers/megadrive.py +32 -0
- uppercut_rom_headers/n64.py +70 -0
- uppercut_rom_headers/py.typed +0 -0
- uppercut_rom_headers-1.0.0.dist-info/METADATA +86 -0
- uppercut_rom_headers-1.0.0.dist-info/RECORD +13 -0
- uppercut_rom_headers-1.0.0.dist-info/WHEEL +4 -0
- uppercut_rom_headers-1.0.0.dist-info/entry_points.txt +2 -0
- uppercut_rom_headers-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Compute, fix and verify the header checksums of Nintendo 64, Mega Drive and 32X, and Game Boy Advance ROM images."""
|
|
2
|
+
|
|
3
|
+
from ._checks import RomHeaderError, Verification
|
|
4
|
+
from .cli import main
|
|
5
|
+
from .gba import compute_gba_complement, fix_gba_complement, verify_gba_complement
|
|
6
|
+
from .megadrive import compute_megadrive_checksum, fix_megadrive_checksum, verify_megadrive_checksum
|
|
7
|
+
from .n64 import N64Checksums, compute_n64_checksums, fix_n64_checksums, verify_n64_checksums
|
|
8
|
+
|
|
9
|
+
__all__ = [
|
|
10
|
+
"N64Checksums",
|
|
11
|
+
"RomHeaderError",
|
|
12
|
+
"Verification",
|
|
13
|
+
"compute_gba_complement",
|
|
14
|
+
"compute_megadrive_checksum",
|
|
15
|
+
"compute_n64_checksums",
|
|
16
|
+
"fix_gba_complement",
|
|
17
|
+
"fix_megadrive_checksum",
|
|
18
|
+
"fix_n64_checksums",
|
|
19
|
+
"main",
|
|
20
|
+
"verify_gba_complement",
|
|
21
|
+
"verify_megadrive_checksum",
|
|
22
|
+
"verify_n64_checksums",
|
|
23
|
+
]
|
|
24
|
+
__version__ = "1.0.0"
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"""Shared types: the error, the verification result and the input checks."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from typing import Tuple, Union
|
|
7
|
+
|
|
8
|
+
ByteString = Union[bytes, bytearray, memoryview]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class RomHeaderError(ValueError):
|
|
12
|
+
"""Raised when a ROM image is too short for the checksum, or is not a byte buffer."""
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class Verification:
|
|
17
|
+
"""The outcome of a ``verify_*`` call.
|
|
18
|
+
|
|
19
|
+
``expected`` is what the image's contents give, ``found`` is what its header holds. Each is a tuple of
|
|
20
|
+
integers: ``(crc1, crc2)`` for Nintendo 64, one value for Mega Drive and Game Boy Advance.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
ok: bool
|
|
24
|
+
expected: Tuple[int, ...]
|
|
25
|
+
found: Tuple[int, ...]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def require_length(rom: ByteString, minimum: int, what: str) -> None:
|
|
29
|
+
if not isinstance(rom, (bytes, bytearray, memoryview)):
|
|
30
|
+
raise RomHeaderError(f"{what} must be bytes, bytearray or memoryview, not {type(rom).__name__}")
|
|
31
|
+
if len(rom) < minimum:
|
|
32
|
+
raise RomHeaderError(f"{what} is too short for its checksum: {len(rom)} bytes, need at least {minimum}")
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def require_writable(rom: ByteString) -> None:
|
|
36
|
+
if not isinstance(rom, bytearray):
|
|
37
|
+
raise RomHeaderError(f"fixing a checksum writes into the image, so it must be a bytearray, not {type(rom).__name__}")
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"""Command line: fix or verify the header checksum of a ROM file."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import argparse
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Callable, Optional, Sequence
|
|
9
|
+
|
|
10
|
+
from ._checks import RomHeaderError, Verification
|
|
11
|
+
from .gba import fix_gba_complement, verify_gba_complement
|
|
12
|
+
from .megadrive import fix_megadrive_checksum, verify_megadrive_checksum
|
|
13
|
+
from .n64 import fix_n64_checksums, verify_n64_checksums
|
|
14
|
+
|
|
15
|
+
# For each format: the verifier and the number of hex digits to show per value.
|
|
16
|
+
_VERIFIERS: dict[str, tuple[Callable[[bytearray], Verification], int]] = {
|
|
17
|
+
"n64": (verify_n64_checksums, 8),
|
|
18
|
+
"megadrive": (verify_megadrive_checksum, 4),
|
|
19
|
+
"gba": (verify_gba_complement, 2),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def build_parser() -> argparse.ArgumentParser:
|
|
24
|
+
parser = argparse.ArgumentParser(
|
|
25
|
+
prog="uppercut-rom-headers",
|
|
26
|
+
description="Fix or verify the header checksum of a Nintendo 64, Mega Drive or 32X, or Game Boy Advance ROM.",
|
|
27
|
+
)
|
|
28
|
+
parser.add_argument("action", choices=("fix", "verify"), help="write the checksum into the file, or check it")
|
|
29
|
+
parser.add_argument(
|
|
30
|
+
"format",
|
|
31
|
+
choices=tuple(_VERIFIERS),
|
|
32
|
+
help="n64 (CIC-6102 CRC1 and CRC2), megadrive (also 32X) or gba (header complement)",
|
|
33
|
+
)
|
|
34
|
+
parser.add_argument("rom", help="path to the ROM file")
|
|
35
|
+
parser.add_argument(
|
|
36
|
+
"--preserve-zero-header",
|
|
37
|
+
action="store_true",
|
|
38
|
+
help="n64 fix only: leave an image whose two CRC words are both zero as it is",
|
|
39
|
+
)
|
|
40
|
+
return parser
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _show(values: Sequence[int], digits: int) -> str:
|
|
44
|
+
return ", ".join(f"0x{value:0{digits}X}" for value in values)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def main(argv: Optional[Sequence[str]] = None) -> int:
|
|
48
|
+
"""Run the command line. Returns 0 on success, 1 when a verification fails and 2 for a file or usage error."""
|
|
49
|
+
args = build_parser().parse_args(argv)
|
|
50
|
+
path = Path(args.rom)
|
|
51
|
+
verifier, digits = _VERIFIERS[args.format]
|
|
52
|
+
try:
|
|
53
|
+
image = bytearray(path.read_bytes())
|
|
54
|
+
except OSError as error:
|
|
55
|
+
print(f"cannot read {path}: {error.strerror or error}", file=sys.stderr)
|
|
56
|
+
return 2
|
|
57
|
+
try:
|
|
58
|
+
if args.action == "verify":
|
|
59
|
+
result = verifier(image)
|
|
60
|
+
text = f"{args.format} header: expected {_show(result.expected, digits)}, found {_show(result.found, digits)}"
|
|
61
|
+
if result.ok:
|
|
62
|
+
print(f"PASS {text}")
|
|
63
|
+
return 0
|
|
64
|
+
print(f"FAIL {text}", file=sys.stderr)
|
|
65
|
+
return 1
|
|
66
|
+
if args.format == "n64":
|
|
67
|
+
fixed = fix_n64_checksums(image, preserve_zero_header=args.preserve_zero_header)
|
|
68
|
+
if fixed.skipped:
|
|
69
|
+
print(f"left {path} as it is: both n64 CRC words are zero")
|
|
70
|
+
return 0
|
|
71
|
+
elif args.format == "megadrive":
|
|
72
|
+
fix_megadrive_checksum(image)
|
|
73
|
+
else:
|
|
74
|
+
fix_gba_complement(image)
|
|
75
|
+
written = verifier(image).expected
|
|
76
|
+
except RomHeaderError as error:
|
|
77
|
+
print(f"{path}: {error}", file=sys.stderr)
|
|
78
|
+
return 2
|
|
79
|
+
try:
|
|
80
|
+
path.write_bytes(image)
|
|
81
|
+
except OSError as error:
|
|
82
|
+
print(f"cannot write {path}: {error.strerror or error}", file=sys.stderr)
|
|
83
|
+
return 2
|
|
84
|
+
print(f"fixed {args.format} header of {path}: {_show(written, digits)}")
|
|
85
|
+
return 0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""The Game Boy Advance header complement byte at 0xBD."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from ._checks import ByteString, Verification, require_length, require_writable
|
|
6
|
+
|
|
7
|
+
HEADER_SIZE = 0xC0
|
|
8
|
+
COMPLEMENT_OFFSET = 0xBD
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def compute_gba_complement(rom: ByteString) -> int:
|
|
12
|
+
"""The complement of the header bytes 0xA0 to 0xBC: ``-(sum + 0x19)`` modulo 256."""
|
|
13
|
+
require_length(rom, HEADER_SIZE, "GBA ROM")
|
|
14
|
+
return (-sum(rom[0xA0:COMPLEMENT_OFFSET]) - 0x19) & 0xFF
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def fix_gba_complement(rom: bytearray) -> int:
|
|
18
|
+
"""Write the complement byte at 0xBD and return it."""
|
|
19
|
+
require_writable(rom)
|
|
20
|
+
complement = compute_gba_complement(rom)
|
|
21
|
+
rom[COMPLEMENT_OFFSET] = complement
|
|
22
|
+
return complement
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def verify_gba_complement(rom: ByteString) -> Verification:
|
|
26
|
+
"""Compare the header's complement byte with the one its header bytes give."""
|
|
27
|
+
expected = compute_gba_complement(rom)
|
|
28
|
+
return Verification(ok=rom[COMPLEMENT_OFFSET] == expected, expected=(expected,), found=(rom[COMPLEMENT_OFFSET],))
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""The Mega Drive and 32X header checksum: the sum of every 16-bit word from 0x200 to the end of the image."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import struct
|
|
6
|
+
|
|
7
|
+
from ._checks import ByteString, Verification, require_length, require_writable
|
|
8
|
+
|
|
9
|
+
SUM_START = 0x200
|
|
10
|
+
CHECKSUM_OFFSET = 0x18E
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def compute_megadrive_checksum(rom: ByteString) -> int:
|
|
14
|
+
"""The big-endian 16-bit word sum of the image from 0x200, modulo 65536. A trailing odd byte is not counted."""
|
|
15
|
+
require_length(rom, SUM_START, "Mega Drive ROM")
|
|
16
|
+
words = (len(rom) - SUM_START) // 2
|
|
17
|
+
return sum(struct.unpack_from(f">{words}H", rom, SUM_START)) & 0xFFFF
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def fix_megadrive_checksum(rom: bytearray) -> int:
|
|
21
|
+
"""Write the checksum big-endian at 0x18E and return it."""
|
|
22
|
+
require_writable(rom)
|
|
23
|
+
checksum = compute_megadrive_checksum(rom)
|
|
24
|
+
struct.pack_into(">H", rom, CHECKSUM_OFFSET, checksum)
|
|
25
|
+
return checksum
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def verify_megadrive_checksum(rom: ByteString) -> Verification:
|
|
29
|
+
"""Compare the header's checksum word with the image's word sum."""
|
|
30
|
+
expected = compute_megadrive_checksum(rom)
|
|
31
|
+
(found,) = struct.unpack_from(">H", rom, CHECKSUM_OFFSET)
|
|
32
|
+
return Verification(ok=found == expected, expected=(expected,), found=(found,))
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"""Nintendo 64 header CRCs for the CIC-6102 boot code (and its 6101 sibling, which uses the same seed and formula)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import struct
|
|
6
|
+
from dataclasses import dataclass
|
|
7
|
+
|
|
8
|
+
from ._checks import ByteString, Verification, require_length, require_writable
|
|
9
|
+
|
|
10
|
+
CRC_RANGE_START = 0x1000
|
|
11
|
+
CRC_RANGE_END = 0x101000
|
|
12
|
+
CRC1_OFFSET = 0x10
|
|
13
|
+
CRC2_OFFSET = 0x14
|
|
14
|
+
CIC_6102_SEED = 0xF8CA4DDC
|
|
15
|
+
|
|
16
|
+
_WORDS = (CRC_RANGE_END - CRC_RANGE_START) // 4
|
|
17
|
+
_MASK = 0xFFFFFFFF
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@dataclass(frozen=True)
|
|
21
|
+
class N64Checksums:
|
|
22
|
+
"""The two header CRCs. ``skipped`` is set when ``preserve_zero_header`` left an all-zero header alone."""
|
|
23
|
+
|
|
24
|
+
crc1: int
|
|
25
|
+
crc2: int
|
|
26
|
+
skipped: bool = False
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def compute_n64_checksums(rom: ByteString) -> N64Checksums:
|
|
30
|
+
"""CRC1 and CRC2 of the 1 MiB at 0x1000, for CIC-6102. The image must reach 0x101000."""
|
|
31
|
+
require_length(rom, CRC_RANGE_END, "N64 ROM")
|
|
32
|
+
words = struct.unpack_from(f">{_WORDS}I", rom, CRC_RANGE_START)
|
|
33
|
+
t1 = t2 = t3 = t4 = t5 = t6 = CIC_6102_SEED
|
|
34
|
+
for d in words:
|
|
35
|
+
total = t6 + d
|
|
36
|
+
if total > _MASK:
|
|
37
|
+
t4 = (t4 + 1) & _MASK
|
|
38
|
+
t6 = total & _MASK
|
|
39
|
+
t3 ^= d
|
|
40
|
+
shift = d & 0x1F
|
|
41
|
+
rotated = ((d << shift) | (d >> (32 - shift))) & _MASK if shift else d
|
|
42
|
+
t5 = (t5 + rotated) & _MASK
|
|
43
|
+
if t2 > d:
|
|
44
|
+
t2 ^= rotated
|
|
45
|
+
else:
|
|
46
|
+
t2 ^= t6 ^ d
|
|
47
|
+
t1 = (t1 + (t5 ^ d)) & _MASK
|
|
48
|
+
return N64Checksums(crc1=t6 ^ t4 ^ t3, crc2=t5 ^ t2 ^ t1)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def fix_n64_checksums(rom: bytearray, *, preserve_zero_header: bool = False) -> N64Checksums:
|
|
52
|
+
"""Write CRC1 and CRC2 big-endian at 0x10 and 0x14 and return them.
|
|
53
|
+
|
|
54
|
+
With ``preserve_zero_header`` an image whose two header words are both zero is left as it is (some toolchains
|
|
55
|
+
leave them zero on purpose) and ``N64Checksums(0, 0, skipped=True)`` is returned.
|
|
56
|
+
"""
|
|
57
|
+
require_writable(rom)
|
|
58
|
+
require_length(rom, CRC_RANGE_END, "N64 ROM")
|
|
59
|
+
if preserve_zero_header and struct.unpack_from(">II", rom, CRC1_OFFSET) == (0, 0):
|
|
60
|
+
return N64Checksums(0, 0, skipped=True)
|
|
61
|
+
checksums = compute_n64_checksums(rom)
|
|
62
|
+
struct.pack_into(">II", rom, CRC1_OFFSET, checksums.crc1, checksums.crc2)
|
|
63
|
+
return checksums
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def verify_n64_checksums(rom: ByteString) -> Verification:
|
|
67
|
+
"""Compare the header's CRC1 and CRC2 with what the image's contents give."""
|
|
68
|
+
expected = compute_n64_checksums(rom)
|
|
69
|
+
found = struct.unpack_from(">II", rom, CRC1_OFFSET)
|
|
70
|
+
return Verification(ok=found == (expected.crc1, expected.crc2), expected=(expected.crc1, expected.crc2), found=found)
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: uppercut-rom-headers
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Compute, fix and verify the header checksums of Nintendo 64, Mega Drive and 32X, and Game Boy Advance ROM images.
|
|
5
|
+
Project-URL: Source, https://github.com/uppercut-labs/game-kit/tree/main/packages/uppercut-rom-headers
|
|
6
|
+
Author-email: Uppercut Labs <packages@uppercut-labs.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: 32x,checksum,gba,header,homebrew,mega-drive,n64,rom
|
|
10
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Games/Entertainment
|
|
19
|
+
Classifier: Typing :: Typed
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# uppercut-rom-headers
|
|
24
|
+
|
|
25
|
+
Computes, writes and checks the header checksums that homebrew ROM builds have to get right: the two CRCs of a Nintendo 64 image (CIC-6102), the word checksum of a Mega Drive or 32X image, and the header complement byte of a Game Boy Advance image. Each format has a `compute_`, a `fix_` and a `verify_` function, and there is a small command line. Standard library only.
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
pip install uppercut-rom-headers
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Python
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
from uppercut_rom_headers import fix_n64_checksums, verify_n64_checksums
|
|
35
|
+
|
|
36
|
+
image = bytearray(open("game.z64", "rb").read())
|
|
37
|
+
crcs = fix_n64_checksums(image) # writes CRC1 and CRC2 at 0x10 and 0x14
|
|
38
|
+
print(hex(crcs.crc1), hex(crcs.crc2))
|
|
39
|
+
assert verify_n64_checksums(image).ok
|
|
40
|
+
open("game.z64", "wb").write(image)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
| Format | Compute | Fix (writes into a `bytearray`, returns the value) | Verify (returns `Verification`) |
|
|
44
|
+
| --- | --- | --- | --- |
|
|
45
|
+
| Nintendo 64, CIC-6102 | `compute_n64_checksums(rom)` returns `N64Checksums(crc1, crc2)` | `fix_n64_checksums(rom, preserve_zero_header=False)` | `verify_n64_checksums(rom)` |
|
|
46
|
+
| Mega Drive and 32X | `compute_megadrive_checksum(rom)` | `fix_megadrive_checksum(rom)` | `verify_megadrive_checksum(rom)` |
|
|
47
|
+
| Game Boy Advance | `compute_gba_complement(rom)` | `fix_gba_complement(rom)` | `verify_gba_complement(rom)` |
|
|
48
|
+
|
|
49
|
+
`Verification` has `ok`, `expected` (what the contents give) and `found` (what the header holds), each a tuple of integers. The `compute_` and `verify_` functions take `bytes`, `bytearray` or `memoryview`; the `fix_` functions need a `bytearray`. An image that is too short for its checksum raises `RomHeaderError`, a `ValueError`.
|
|
50
|
+
|
|
51
|
+
| Format | What is summed | Where it goes | Smallest image |
|
|
52
|
+
| --- | --- | --- | --- |
|
|
53
|
+
| Nintendo 64 | the 1 MiB at 0x1000 to 0x101000, as big-endian 32-bit words, with the CIC-6102 seed | CRC1 at 0x10 and CRC2 at 0x14, big-endian | 0x101000 bytes |
|
|
54
|
+
| Mega Drive and 32X | every big-endian 16-bit word from 0x200 to the end of the image, modulo 65536; a trailing odd byte is not counted | 0x18E, big-endian | 0x200 bytes |
|
|
55
|
+
| Game Boy Advance | bytes 0xA0 to 0xBC: the complement is `-(sum + 0x19)` modulo 256 | 0xBD | 0xC0 bytes |
|
|
56
|
+
|
|
57
|
+
`preserve_zero_header=True` leaves a Nintendo 64 image alone when both header words are already zero, for toolchains that leave them zero on purpose; the result then has `skipped=True`.
|
|
58
|
+
|
|
59
|
+
## Command line
|
|
60
|
+
|
|
61
|
+
```sh
|
|
62
|
+
uppercut-rom-headers fix n64 game.z64
|
|
63
|
+
uppercut-rom-headers verify megadrive game.32x
|
|
64
|
+
python -m uppercut_rom_headers verify gba game.gba
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`fix` rewrites the file in place. `verify` prints `PASS ...` to stdout or `FAIL ...` to stderr with the expected and found values. The exit code is 0 for success, 1 when a verification fails and 2 for a missing, unreadable or too short file.
|
|
68
|
+
|
|
69
|
+
## Notes
|
|
70
|
+
|
|
71
|
+
- The Nintendo 64 CRC is the CIC-6102 algorithm, which CIC-6101 shares. The final values are `t6 ^ t4 ^ t3` and `t5 ^ t2 ^ t1`. Some code combines them with `+` as CIC-6103 does, while keeping the 6102 seed; that gives CRCs that a 6102 boot check does not accept. CIC-6103, 6105 and 6106 are not implemented.
|
|
72
|
+
- The header complement of a Game Boy Advance image is the same one that `uppercut-gba-rom-verify` checks. This package fixes and verifies the byte alone; that package checks the whole header, the ELF and the SHA-256. The tests compare the two when both are installed.
|
|
73
|
+
- Only the checksums are here. Logos, security blocks, licence data and boot code are not, and a checksum alone does not make an image bootable.
|
|
74
|
+
- The tests use synthetic images from a fixed pseudo-random stream. The expected checksums were written by an independent implementation of the same algorithms.
|
|
75
|
+
|
|
76
|
+
## Working on it
|
|
77
|
+
|
|
78
|
+
From the repository root:
|
|
79
|
+
|
|
80
|
+
```sh
|
|
81
|
+
uv sync --all-packages && uv run pytest packages/uppercut-rom-headers
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## License
|
|
85
|
+
|
|
86
|
+
MIT
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
uppercut_rom_headers/__init__.py,sha256=VNYQudPI1ZVfV2bWr_u3ffdFhFGLeLbIi61-NnczPuU,846
|
|
2
|
+
uppercut_rom_headers/__main__.py,sha256=E6Gls0DNz8GQK2K-kOUIx8cYhgANW_CH54VKrfCfs14,52
|
|
3
|
+
uppercut_rom_headers/_checks.py,sha256=VUro6wJ-mzH8iMWusTUtu7kNyRhv6JSJxuzf6KusJcE,1318
|
|
4
|
+
uppercut_rom_headers/cli.py,sha256=67bSMfc-vq3bFE4WnPQEOfezjf-RuXVuUauMEqKeZtE,3287
|
|
5
|
+
uppercut_rom_headers/gba.py,sha256=e4K8VNeA-0wPI1Q5vZ-UeHEpPkDtNfTlHfuT5K6UlI0,1020
|
|
6
|
+
uppercut_rom_headers/megadrive.py,sha256=LPC3Esk4boBvtGKpt9vrXcOyqX3lmspLmozfHPLGeaQ,1227
|
|
7
|
+
uppercut_rom_headers/n64.py,sha256=qCpgvVN32XO-xyDR6XCpdVN3eVf_eenBEOnkapx_708,2564
|
|
8
|
+
uppercut_rom_headers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
uppercut_rom_headers-1.0.0.dist-info/METADATA,sha256=qPQkaAUw5p8hQLxUx2mBr3jFmFJS-KsUekg-B_DhkgY,4817
|
|
10
|
+
uppercut_rom_headers-1.0.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
11
|
+
uppercut_rom_headers-1.0.0.dist-info/entry_points.txt,sha256=AaOuDKtLY9WrN_0iJw7RqEcX__nE22xMfSHsDdt0CRk,71
|
|
12
|
+
uppercut_rom_headers-1.0.0.dist-info/licenses/LICENSE,sha256=UnrCwITmmm38G2l4XYqZ16-3vR4juohAYGNuz1UwsiQ,1070
|
|
13
|
+
uppercut_rom_headers-1.0.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Uppercut Labs
|
|
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.
|