ines-parser 1.3.0__tar.gz → 1.4.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.
- {ines_parser-1.3.0 → ines_parser-1.4.0}/PKG-INFO +5 -2
- {ines_parser-1.3.0 → ines_parser-1.4.0}/README.md +4 -1
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/__init__.py +14 -2
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/cli/ines_rom_stats.py +1 -1
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/cli/ines_scan_roms.py +88 -23
- ines_parser-1.4.0/ines_parser/mappers.py +24 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/parser.py +18 -1
- ines_parser-1.3.0/ines_parser/mappers.py → ines_parser-1.4.0/ines_parser/tables.py +322 -10
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser.egg-info/PKG-INFO +5 -2
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser.egg-info/SOURCES.txt +1 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/pyproject.toml +1 -1
- {ines_parser-1.3.0 → ines_parser-1.4.0}/LICENSE +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/cli/__init__.py +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/cli/ines_split_rom.py +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser/cli/rom_fs.py +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser.egg-info/dependency_links.txt +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser.egg-info/entry_points.txt +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser.egg-info/requires.txt +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/ines_parser.egg-info/top_level.txt +0 -0
- {ines_parser-1.3.0 → ines_parser-1.4.0}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ines-parser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Parse iNES/NES 2.0 ROM headers; CLI to scan, export, summarize, and split ROMs
|
|
5
5
|
Author: Leonid Kabanov
|
|
6
6
|
License-Expression: MIT
|
|
@@ -89,7 +89,10 @@ if header and header.is_valid():
|
|
|
89
89
|
|
|
90
90
|
## Docs
|
|
91
91
|
|
|
92
|
-
- `docs/iNES.md`
|
|
92
|
+
- `docs/iNES.md` — iNES header notes
|
|
93
|
+
- `docs/NES2.0.md` — NES 2.0 header layout
|
|
94
|
+
- `docs/List of iNES mappers.md` — mapper and submapper name tables (from `ines_parser/tables.py`)
|
|
95
|
+
- `docs/NES 2.0 lookups.md` — Vs. PPU/hardware, extended console, expansion device names
|
|
93
96
|
- [NESdev iNES](https://www.nesdev.org/wiki/INES)
|
|
94
97
|
- [NESdev NES 2.0](https://www.nesdev.org/wiki/NES_2.0)
|
|
95
98
|
|
|
@@ -61,7 +61,10 @@ if header and header.is_valid():
|
|
|
61
61
|
|
|
62
62
|
## Docs
|
|
63
63
|
|
|
64
|
-
- `docs/iNES.md`
|
|
64
|
+
- `docs/iNES.md` — iNES header notes
|
|
65
|
+
- `docs/NES2.0.md` — NES 2.0 header layout
|
|
66
|
+
- `docs/List of iNES mappers.md` — mapper and submapper name tables (from `ines_parser/tables.py`)
|
|
67
|
+
- `docs/NES 2.0 lookups.md` — Vs. PPU/hardware, extended console, expansion device names
|
|
65
68
|
- [NESdev iNES](https://www.nesdev.org/wiki/INES)
|
|
66
69
|
- [NESdev NES 2.0](https://www.nesdev.org/wiki/NES_2.0)
|
|
67
70
|
|
|
@@ -17,15 +17,21 @@ from .parser import (
|
|
|
17
17
|
INES_TRAINER_SIZE,
|
|
18
18
|
)
|
|
19
19
|
|
|
20
|
-
from .
|
|
20
|
+
from .tables import (
|
|
21
21
|
get_mapper_name,
|
|
22
22
|
get_mapper_alternate_names,
|
|
23
23
|
get_mapper_notes,
|
|
24
24
|
get_mapper_info,
|
|
25
25
|
is_known_mapper,
|
|
26
|
+
get_vs_ppu_type_name,
|
|
27
|
+
get_vs_hw_type_name,
|
|
28
|
+
get_extended_console_type_name,
|
|
29
|
+
get_expansion_device_name,
|
|
30
|
+
get_submapper_name,
|
|
31
|
+
is_known_submapper,
|
|
26
32
|
)
|
|
27
33
|
|
|
28
|
-
__version__ = "1.
|
|
34
|
+
__version__ = "1.4.0"
|
|
29
35
|
__author__ = "Leonid Kabanov"
|
|
30
36
|
__all__ = [
|
|
31
37
|
"parse_ines_header",
|
|
@@ -42,5 +48,11 @@ __all__ = [
|
|
|
42
48
|
"get_mapper_notes",
|
|
43
49
|
"get_mapper_info",
|
|
44
50
|
"is_known_mapper",
|
|
51
|
+
"get_vs_ppu_type_name",
|
|
52
|
+
"get_vs_hw_type_name",
|
|
53
|
+
"get_extended_console_type_name",
|
|
54
|
+
"get_expansion_device_name",
|
|
55
|
+
"get_submapper_name",
|
|
56
|
+
"is_known_submapper",
|
|
45
57
|
]
|
|
46
58
|
|
|
@@ -23,7 +23,7 @@ except ImportError:
|
|
|
23
23
|
libarchive = None # type: ignore
|
|
24
24
|
|
|
25
25
|
from ines_parser import INES_HEADER_SIZE, parse_ines_header
|
|
26
|
-
from ines_parser.
|
|
26
|
+
from ines_parser.tables import get_mapper_name
|
|
27
27
|
|
|
28
28
|
from ines_parser.cli.rom_fs import (
|
|
29
29
|
ALL_ARCHIVE_FORMATS,
|
|
@@ -65,6 +65,7 @@ _FULL_COLUMNS = (
|
|
|
65
65
|
"tv_system",
|
|
66
66
|
"mapper",
|
|
67
67
|
"submapper",
|
|
68
|
+
"submapper_name",
|
|
68
69
|
"mapper_name",
|
|
69
70
|
"mapper_alternates",
|
|
70
71
|
"mapper_notes",
|
|
@@ -77,19 +78,79 @@ _FULL_COLUMNS = (
|
|
|
77
78
|
"console_type",
|
|
78
79
|
"cpu_timing",
|
|
79
80
|
"vs_ppu_type",
|
|
81
|
+
"vs_ppu_type_name",
|
|
80
82
|
"vs_hw_type",
|
|
83
|
+
"vs_hw_type_name",
|
|
81
84
|
"extended_console_type",
|
|
85
|
+
"extended_console_type_name",
|
|
82
86
|
"misc_rom_count",
|
|
83
87
|
"expansion_device",
|
|
88
|
+
"expansion_device_name",
|
|
84
89
|
"has_bus_conflicts",
|
|
85
90
|
)
|
|
86
91
|
|
|
92
|
+
# Human-facing labels for text / CSV / HTML (JSON keeps internal keys).
|
|
93
|
+
_COLUMN_LABELS = {
|
|
94
|
+
"path": "Path",
|
|
95
|
+
"archive_member": "Archive Member",
|
|
96
|
+
"format": "Format",
|
|
97
|
+
"valid": "Valid",
|
|
98
|
+
"prg_rom_size": "PRG ROM Size",
|
|
99
|
+
"chr_rom_size": "CHR ROM Size",
|
|
100
|
+
"prg_ram_size": "PRG RAM Size",
|
|
101
|
+
"prg_nvram_size": "PRG NVRAM Size",
|
|
102
|
+
"chr_ram_size": "CHR RAM Size",
|
|
103
|
+
"chr_nvram_size": "CHR NVRAM Size",
|
|
104
|
+
"tv_system": "TV System",
|
|
105
|
+
"mapper": "Mapper",
|
|
106
|
+
"submapper": "Submapper",
|
|
107
|
+
"submapper_name": "Submapper Name",
|
|
108
|
+
"mapper_name": "Mapper Name",
|
|
109
|
+
"mapper_alternates": "Mapper Alternates",
|
|
110
|
+
"mapper_notes": "Mapper Notes",
|
|
111
|
+
"mirroring": "Mirroring",
|
|
112
|
+
"has_battery": "Has Battery",
|
|
113
|
+
"has_trainer": "Has Trainer",
|
|
114
|
+
"four_screen": "Four Screen",
|
|
115
|
+
"is_vs_unisystem": "Vs Unisystem",
|
|
116
|
+
"is_playchoice_10": "PlayChoice-10",
|
|
117
|
+
"console_type": "Console Type",
|
|
118
|
+
"cpu_timing": "CPU Timing",
|
|
119
|
+
"vs_ppu_type": "Vs PPU Type",
|
|
120
|
+
"vs_ppu_type_name": "Vs PPU Type Name",
|
|
121
|
+
"vs_hw_type": "Vs Hardware Type",
|
|
122
|
+
"vs_hw_type_name": "Vs Hardware Type Name",
|
|
123
|
+
"extended_console_type": "Extended Console Type",
|
|
124
|
+
"extended_console_type_name": "Extended Console Type Name",
|
|
125
|
+
"misc_rom_count": "Misc ROM Count",
|
|
126
|
+
"expansion_device": "Expansion Device",
|
|
127
|
+
"expansion_device_name": "Expansion Device Name",
|
|
128
|
+
"has_bus_conflicts": "Has Bus Conflicts",
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
# Numeric id + companion name key (paired in text export like mapper).
|
|
132
|
+
_ID_NAME_PAIRS = {
|
|
133
|
+
"mapper": "mapper_name",
|
|
134
|
+
"submapper": "submapper_name",
|
|
135
|
+
"vs_ppu_type": "vs_ppu_type_name",
|
|
136
|
+
"vs_hw_type": "vs_hw_type_name",
|
|
137
|
+
"extended_console_type": "extended_console_type_name",
|
|
138
|
+
"expansion_device": "expansion_device_name",
|
|
139
|
+
}
|
|
140
|
+
|
|
87
141
|
|
|
88
142
|
def _is_size_key(key: str) -> bool:
|
|
89
143
|
"""True for header size fields (bytes in to_dict; KiB in short mode)."""
|
|
90
144
|
return key.endswith("_size")
|
|
91
145
|
|
|
92
146
|
|
|
147
|
+
def _friendly_label(key: str) -> str:
|
|
148
|
+
"""Human-readable column / field label (Title Case, no underscores)."""
|
|
149
|
+
if key in _COLUMN_LABELS:
|
|
150
|
+
return _COLUMN_LABELS[key]
|
|
151
|
+
return key.replace("_", " ").title()
|
|
152
|
+
|
|
153
|
+
|
|
93
154
|
def _header_columns(show_all: bool) -> tuple[str, ...]:
|
|
94
155
|
return _FULL_COLUMNS if show_all else _BASIC_COLUMNS
|
|
95
156
|
|
|
@@ -130,10 +191,13 @@ def _write_csv(
|
|
|
130
191
|
delimiter: str = ",",
|
|
131
192
|
) -> None:
|
|
132
193
|
columns = _collect_columns(rows, show_all)
|
|
133
|
-
|
|
194
|
+
labels = [_friendly_label(col) for col in columns]
|
|
195
|
+
writer = csv.DictWriter(out, fieldnames=labels, delimiter=delimiter, lineterminator="\n")
|
|
134
196
|
writer.writeheader()
|
|
135
197
|
for row in rows:
|
|
136
|
-
writer.writerow(
|
|
198
|
+
writer.writerow(
|
|
199
|
+
{_friendly_label(col): _flatten_cell(row.get(col)) for col in columns}
|
|
200
|
+
)
|
|
137
201
|
|
|
138
202
|
|
|
139
203
|
def _write_json(rows: Sequence[dict[str, Any]], out: TextIO, show_all: bool) -> None:
|
|
@@ -179,7 +243,7 @@ def _write_html(rows: Sequence[dict[str, Any]], out: TextIO, show_all: bool) ->
|
|
|
179
243
|
out.write("<h1>iNES ROM scan</h1>\n")
|
|
180
244
|
out.write(f"<table>\n<caption>{len(rows)} ROM(s)</caption>\n<thead>\n<tr>\n")
|
|
181
245
|
for col in columns:
|
|
182
|
-
out.write(f"<th>{html.escape(col)}</th>\n")
|
|
246
|
+
out.write(f"<th>{html.escape(_friendly_label(col))}</th>\n")
|
|
183
247
|
out.write("</tr>\n</thead>\n<tbody>\n")
|
|
184
248
|
for row in rows:
|
|
185
249
|
out.write("<tr>\n")
|
|
@@ -261,22 +325,18 @@ def _format_row_text(row: dict[str, Any], show_all: bool = False) -> str:
|
|
|
261
325
|
if key in skip:
|
|
262
326
|
continue
|
|
263
327
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
328
|
+
name_key = _ID_NAME_PAIRS.get(key)
|
|
329
|
+
if name_key is not None:
|
|
330
|
+
id_value = row.get(key)
|
|
331
|
+
name = row.get(name_key)
|
|
332
|
+
if id_value is None:
|
|
268
333
|
continue
|
|
334
|
+
label = _friendly_label(key)
|
|
269
335
|
if name:
|
|
270
|
-
parts.append(f"
|
|
271
|
-
skip.add(
|
|
336
|
+
parts.append(f"{label}: {id_value} ({name})")
|
|
337
|
+
skip.add(name_key)
|
|
272
338
|
else:
|
|
273
|
-
parts.append(f"
|
|
274
|
-
continue
|
|
275
|
-
|
|
276
|
-
if key == "mapper_name":
|
|
277
|
-
name = row.get("mapper_name")
|
|
278
|
-
if name:
|
|
279
|
-
parts.append(f"mapper_name: {name}")
|
|
339
|
+
parts.append(f"{label}: {id_value}")
|
|
280
340
|
continue
|
|
281
341
|
|
|
282
342
|
value = row.get(key)
|
|
@@ -285,6 +345,8 @@ def _format_row_text(row: dict[str, Any], show_all: bool = False) -> str:
|
|
|
285
345
|
if value == "" or value == []:
|
|
286
346
|
continue
|
|
287
347
|
|
|
348
|
+
label = _friendly_label(key)
|
|
349
|
+
|
|
288
350
|
if _is_size_key(key):
|
|
289
351
|
if not isinstance(value, int):
|
|
290
352
|
continue
|
|
@@ -296,19 +358,22 @@ def _format_row_text(row: dict[str, Any], show_all: bool = False) -> str:
|
|
|
296
358
|
elif key == "chr_rom_size":
|
|
297
359
|
parts.append(f"CHR: {value} KiB")
|
|
298
360
|
elif value:
|
|
299
|
-
parts.append(f"{
|
|
361
|
+
parts.append(f"{label}: {value} KiB")
|
|
300
362
|
else:
|
|
301
363
|
if key not in ("prg_rom_size", "chr_rom_size") and not value:
|
|
302
364
|
continue
|
|
303
|
-
parts.append(f"{
|
|
304
|
-
elif key == "mirroring":
|
|
305
|
-
parts.append(f"mirroring: {value}")
|
|
365
|
+
parts.append(f"{label}: {value} bytes")
|
|
306
366
|
elif isinstance(value, bool):
|
|
307
367
|
if value:
|
|
308
|
-
|
|
309
|
-
|
|
368
|
+
short = (
|
|
369
|
+
key.removeprefix("is_")
|
|
370
|
+
.removeprefix("has_")
|
|
371
|
+
.replace("_", " ")
|
|
372
|
+
.title()
|
|
373
|
+
)
|
|
374
|
+
parts.append(short)
|
|
310
375
|
else:
|
|
311
|
-
parts.append(f"{
|
|
376
|
+
parts.append(f"{label}: {_flatten_cell(value)}")
|
|
312
377
|
|
|
313
378
|
return ", ".join(parts)
|
|
314
379
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Backward-compatible re-exports of mapper lookups.
|
|
3
|
+
|
|
4
|
+
Prefer ``ines_parser.tables`` for all header lookup tables (mappers,
|
|
5
|
+
submappers, Vs. types, expansion devices, etc.).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .tables import (
|
|
9
|
+
MAPPER_DATABASE,
|
|
10
|
+
get_mapper_alternate_names,
|
|
11
|
+
get_mapper_info,
|
|
12
|
+
get_mapper_name,
|
|
13
|
+
get_mapper_notes,
|
|
14
|
+
is_known_mapper,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"MAPPER_DATABASE",
|
|
19
|
+
"get_mapper_name",
|
|
20
|
+
"get_mapper_alternate_names",
|
|
21
|
+
"get_mapper_notes",
|
|
22
|
+
"get_mapper_info",
|
|
23
|
+
"is_known_mapper",
|
|
24
|
+
]
|
|
@@ -6,12 +6,17 @@ Based on the iNES and NES 2.0 file format specifications
|
|
|
6
6
|
|
|
7
7
|
from enum import Enum
|
|
8
8
|
from typing import Optional, Dict, Any, List
|
|
9
|
-
from .
|
|
9
|
+
from .tables import (
|
|
10
10
|
get_mapper_name,
|
|
11
11
|
get_mapper_alternate_names,
|
|
12
12
|
get_mapper_notes,
|
|
13
13
|
get_mapper_info,
|
|
14
14
|
is_known_mapper,
|
|
15
|
+
get_vs_ppu_type_name,
|
|
16
|
+
get_vs_hw_type_name,
|
|
17
|
+
get_extended_console_type_name,
|
|
18
|
+
get_expansion_device_name,
|
|
19
|
+
get_submapper_name,
|
|
15
20
|
)
|
|
16
21
|
|
|
17
22
|
|
|
@@ -377,6 +382,9 @@ class INESHeader:
|
|
|
377
382
|
if self.format == INESFormat.NES_2_0:
|
|
378
383
|
if self.submapper is not None:
|
|
379
384
|
result['submapper'] = self.submapper
|
|
385
|
+
result['submapper_name'] = get_submapper_name(
|
|
386
|
+
self.mapper, self.submapper
|
|
387
|
+
)
|
|
380
388
|
if self.prg_nvram_size is not None:
|
|
381
389
|
result['prg_nvram_size'] = self.prg_nvram_size
|
|
382
390
|
if self.chr_ram_size is not None:
|
|
@@ -385,16 +393,25 @@ class INESHeader:
|
|
|
385
393
|
result['chr_nvram_size'] = self.chr_nvram_size
|
|
386
394
|
if self.cpu_timing is not None:
|
|
387
395
|
result['cpu_timing'] = self.cpu_timing.value
|
|
396
|
+
# Lookup fields: keep numeric ids and add human-readable names
|
|
388
397
|
if self.vs_ppu_type is not None:
|
|
389
398
|
result['vs_ppu_type'] = self.vs_ppu_type
|
|
399
|
+
result['vs_ppu_type_name'] = get_vs_ppu_type_name(self.vs_ppu_type)
|
|
390
400
|
if self.vs_hw_type is not None:
|
|
391
401
|
result['vs_hw_type'] = self.vs_hw_type
|
|
402
|
+
result['vs_hw_type_name'] = get_vs_hw_type_name(self.vs_hw_type)
|
|
392
403
|
if self.extended_console_type is not None:
|
|
393
404
|
result['extended_console_type'] = self.extended_console_type
|
|
405
|
+
result['extended_console_type_name'] = get_extended_console_type_name(
|
|
406
|
+
self.extended_console_type
|
|
407
|
+
)
|
|
394
408
|
if self.misc_rom_count is not None:
|
|
395
409
|
result['misc_rom_count'] = self.misc_rom_count
|
|
396
410
|
if self.expansion_device is not None:
|
|
397
411
|
result['expansion_device'] = self.expansion_device
|
|
412
|
+
result['expansion_device_name'] = get_expansion_device_name(
|
|
413
|
+
self.expansion_device
|
|
414
|
+
)
|
|
398
415
|
|
|
399
416
|
# iNES 1.0 specific fields
|
|
400
417
|
if hasattr(self, 'has_bus_conflicts'):
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
"""
|
|
2
|
-
|
|
2
|
+
Header lookup tables for iNES / NES 2.0
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
Includes mapper names, NES 2.0 submappers, Vs. System PPU/hardware types,
|
|
5
|
+
extended console types, and default expansion devices.
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
comments from that file), merged with the curated names from the NESdev
|
|
8
|
-
summary table where those entries overlap. Many mapper numbers outside
|
|
9
|
-
short wiki table only appear here via the MAME mapping.
|
|
7
|
+
Mapper coverage follows MAME's ``nes_ines.hxx`` ``mmc_list`` (PCB identifiers
|
|
8
|
+
and comments from that file), merged with the curated names from the NESdev
|
|
9
|
+
Wiki summary table where those entries overlap. Many mapper numbers outside
|
|
10
|
+
the short wiki table only appear here via the MAME mapping.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
NES 2.0 field names follow the NESdev Wiki specifications.
|
|
13
|
+
|
|
14
|
+
Sources:
|
|
15
|
+
https://www.nesdev.org/wiki/List_of_mappers
|
|
16
|
+
https://www.nesdev.org/wiki/Category:INES_Mappers
|
|
17
|
+
https://www.nesdev.org/wiki/NES_2.0
|
|
18
|
+
https://www.nesdev.org/wiki/NES_2.0_submappers
|
|
19
|
+
https://github.com/mamedev/mame/blob/master/src/devices/bus/nes/nes_ines.hxx
|
|
14
20
|
"""
|
|
15
21
|
|
|
16
|
-
from typing import Dict, List,
|
|
22
|
+
from typing import Any, Dict, List, Optional, Tuple
|
|
17
23
|
|
|
18
24
|
# Mapper database: mapper_number -> (primary_name, [alternate_names], notes)
|
|
19
25
|
MAPPER_DATABASE: Dict[int, tuple] = {
|
|
@@ -485,3 +491,309 @@ def is_known_mapper(mapper_number: int) -> bool:
|
|
|
485
491
|
True if mapper is known, False otherwise
|
|
486
492
|
"""
|
|
487
493
|
return mapper_number in MAPPER_DATABASE
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
# Vs. PPU type (Header byte 13 low nibble when console type is Vs. System)
|
|
497
|
+
VS_PPU_TYPES: Dict[int, str] = {
|
|
498
|
+
0x0: "RP2C03/RC2C03 (any)",
|
|
499
|
+
0x1: "Reserved",
|
|
500
|
+
0x2: "RP2C04-0001",
|
|
501
|
+
0x3: "RP2C04-0002",
|
|
502
|
+
0x4: "RP2C04-0003",
|
|
503
|
+
0x5: "RP2C04-0004",
|
|
504
|
+
0x6: "Reserved",
|
|
505
|
+
0x7: "Reserved",
|
|
506
|
+
0x8: "RC2C05-01",
|
|
507
|
+
0x9: "RC2C05-02",
|
|
508
|
+
0xA: "RC2C05-03",
|
|
509
|
+
0xB: "RC2C05-04",
|
|
510
|
+
0xC: "Reserved",
|
|
511
|
+
0xD: "Reserved",
|
|
512
|
+
0xE: "Reserved",
|
|
513
|
+
0xF: "Reserved",
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
# Vs. Hardware type (Header byte 13 high nibble when console type is Vs. System)
|
|
517
|
+
VS_HW_TYPES: Dict[int, str] = {
|
|
518
|
+
0x0: "Vs. Unisystem (normal)",
|
|
519
|
+
0x1: "Vs. Unisystem (RBI Baseball protection)",
|
|
520
|
+
0x2: "Vs. Unisystem (TKO Boxing protection)",
|
|
521
|
+
0x3: "Vs. Unisystem (Super Xevious protection)",
|
|
522
|
+
0x4: "Vs. Unisystem (Vs. Ice Climber Japan protection)",
|
|
523
|
+
0x5: "Vs. Dual System (normal)",
|
|
524
|
+
0x6: "Vs. Dual System (Raid on Bungeling Bay protection)",
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
# Extended console type (Header byte 13 low nibble when console type is Extended)
|
|
528
|
+
EXTENDED_CONSOLE_TYPES: Dict[int, str] = {
|
|
529
|
+
0x0: "Regular NES/Famicom/Dendy (unused)",
|
|
530
|
+
0x1: "Nintendo Vs. System (unused)",
|
|
531
|
+
0x2: "PlayChoice-10 (unused)",
|
|
532
|
+
0x3: "Famiclone with decimal mode",
|
|
533
|
+
0x4: "NES/Famicom with EPSM",
|
|
534
|
+
0x5: "V.R. Technology VT01 (STN palette)",
|
|
535
|
+
0x6: "V.R. Technology VT02",
|
|
536
|
+
0x7: "V.R. Technology VT03",
|
|
537
|
+
0x8: "V.R. Technology VT09",
|
|
538
|
+
0x9: "V.R. Technology VT32",
|
|
539
|
+
0xA: "V.R. Technology VT369",
|
|
540
|
+
0xB: "UMC UM6578",
|
|
541
|
+
0xC: "Famicom Network System",
|
|
542
|
+
0xD: "Reserved",
|
|
543
|
+
0xE: "Reserved",
|
|
544
|
+
0xF: "Reserved",
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
# Default expansion device (Header byte 15, bits 0-5)
|
|
548
|
+
EXPANSION_DEVICES: Dict[int, str] = {
|
|
549
|
+
0x00: "Unspecified",
|
|
550
|
+
0x01: "Standard NES/Famicom controllers",
|
|
551
|
+
0x02: "NES Four Score/Satellite",
|
|
552
|
+
0x03: "Famicom Four Players Adapter (simple)",
|
|
553
|
+
0x04: "Vs. System (1P via $4016)",
|
|
554
|
+
0x05: "Vs. System (1P via $4017)",
|
|
555
|
+
0x06: "Reserved",
|
|
556
|
+
0x07: "Vs. Zapper",
|
|
557
|
+
0x08: "Zapper ($4017)",
|
|
558
|
+
0x09: "Two Zappers",
|
|
559
|
+
0x0A: "Bandai Hyper Shot Lightgun",
|
|
560
|
+
0x0B: "Power Pad Side A",
|
|
561
|
+
0x0C: "Power Pad Side B",
|
|
562
|
+
0x0D: "Family Trainer Side A",
|
|
563
|
+
0x0E: "Family Trainer Side B",
|
|
564
|
+
0x0F: "Arkanoid Vaus Controller (NES)",
|
|
565
|
+
0x10: "Arkanoid Vaus Controller (Famicom)",
|
|
566
|
+
0x11: "Two Vaus Controllers plus Famicom Data Recorder",
|
|
567
|
+
0x12: "Konami Hyper Shot Controller",
|
|
568
|
+
0x13: "Coconuts Pachinko Controller",
|
|
569
|
+
0x14: "Exciting Boxing Punching Bag",
|
|
570
|
+
0x15: "Jissen Mahjong Controller",
|
|
571
|
+
0x16: "Yonezawa Party Tap",
|
|
572
|
+
0x17: "Oeka Kids Tablet",
|
|
573
|
+
0x18: "Sunsoft Barcode Battler",
|
|
574
|
+
0x19: "Miracle Piano Keyboard",
|
|
575
|
+
0x1A: "Pokkun Moguraa Tap-tap Mat",
|
|
576
|
+
0x1B: "Top Rider",
|
|
577
|
+
0x1C: "Double-Fisted",
|
|
578
|
+
0x1D: "Famicom 3D System",
|
|
579
|
+
0x1E: "Doremikko Keyboard",
|
|
580
|
+
0x1F: "R.O.B. Gyromite",
|
|
581
|
+
0x20: "Famicom Data Recorder (silent keyboard)",
|
|
582
|
+
0x21: "ASCII Turbo File",
|
|
583
|
+
0x22: "IGS Storage Battle Box",
|
|
584
|
+
0x23: "Family BASIC Keyboard plus Famicom Data Recorder",
|
|
585
|
+
0x24: "Dongda PEC Keyboard",
|
|
586
|
+
0x25: "Bit Corp. Bit-79 Keyboard",
|
|
587
|
+
0x26: "Subor Keyboard",
|
|
588
|
+
0x27: "Subor Keyboard plus Macro Winners Mouse",
|
|
589
|
+
0x28: "Subor Keyboard plus Subor Mouse via $4016",
|
|
590
|
+
0x29: "SNES Mouse ($4016)",
|
|
591
|
+
0x2A: "Multicart",
|
|
592
|
+
0x2B: "Two SNES controllers",
|
|
593
|
+
0x2C: "RacerMate Bicycle",
|
|
594
|
+
0x2D: "U-Force",
|
|
595
|
+
0x2E: "R.O.B. Stack-Up",
|
|
596
|
+
0x2F: "City Patrolman Lightgun",
|
|
597
|
+
0x30: "Sharp C1 Cassette Interface",
|
|
598
|
+
0x31: "Standard Controller (swapped axes/buttons)",
|
|
599
|
+
0x32: "Excalibur Sudoku Pad",
|
|
600
|
+
0x33: "ABL Pinball",
|
|
601
|
+
0x34: "Golden Nugget Casino extra buttons",
|
|
602
|
+
0x35: "Keda Keyboard",
|
|
603
|
+
0x36: "Subor Keyboard plus Subor Mouse via $4017",
|
|
604
|
+
0x37: "Port test controller",
|
|
605
|
+
0x38: "Bandai Multi Game Player Gamepad buttons",
|
|
606
|
+
0x39: "Venom TV Dance Mat",
|
|
607
|
+
0x3A: "LG TV Remote Control",
|
|
608
|
+
0x3B: "Famicom Network Controller",
|
|
609
|
+
0x3C: "King Fishing Controller",
|
|
610
|
+
0x3D: "Croaky Karaoke Controller",
|
|
611
|
+
0x3E: "Kingwon Keyboard",
|
|
612
|
+
0x3F: "Zecheng Keyboard",
|
|
613
|
+
0x40: "Subor Keyboard plus L90-rotated PS/2 mouse via $4017",
|
|
614
|
+
0x41: "PS/2 Keyboard (UM6578) plus PS/2 Mouse via $4017",
|
|
615
|
+
0x42: "PS/2 Mouse (UM6578)",
|
|
616
|
+
0x43: "Yuxing Mouse via $4016",
|
|
617
|
+
0x44: "Subor Keyboard plus Yuxing Mouse via $4016",
|
|
618
|
+
0x45: "Gigggle TV Pump",
|
|
619
|
+
0x46: "BBK Keyboard plus R90-rotated PS/2 mouse via $4017",
|
|
620
|
+
0x47: "Magical Cooking",
|
|
621
|
+
0x48: "SNES Mouse ($4017)",
|
|
622
|
+
0x49: "Zapper ($4016)",
|
|
623
|
+
0x4A: "Arkanoid Vaus Controller (Prototype)",
|
|
624
|
+
0x4B: "TV Mahjong Game Controller",
|
|
625
|
+
0x4C: "Mahjong Gekitou Densetsu Controller",
|
|
626
|
+
0x4D: "Subor Keyboard plus X-inverted PS/2 mouse via $4017",
|
|
627
|
+
0x4E: "IBM PC/XT Keyboard",
|
|
628
|
+
0x4F: "Subor Keyboard plus Mega Book Mouse",
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
# (mapper, submapper) -> short name. Submapper 0 is often "Normal" / default iNES.
|
|
632
|
+
# Coverage follows NESdev "NES 2.0 submappers"; unknown pairs fall back in helpers.
|
|
633
|
+
SUBMAPPER_DATABASE: Dict[Tuple[int, int], str] = {
|
|
634
|
+
# MMC1
|
|
635
|
+
(1, 0): "Normal",
|
|
636
|
+
(1, 1): "SUROM (deprecated)",
|
|
637
|
+
(1, 2): "SOROM (deprecated)",
|
|
638
|
+
(1, 3): "MMC1A (deprecated, use mapper 155)",
|
|
639
|
+
(1, 4): "SXROM (deprecated)",
|
|
640
|
+
(1, 5): "Fixed 32 KiB PRG (SEROM/SHROM/SH1ROM)",
|
|
641
|
+
(1, 6): "2ME (Famicom Network System)",
|
|
642
|
+
# UxROM / CNROM / AxROM bus conflicts
|
|
643
|
+
(2, 0): "Default iNES behaviour",
|
|
644
|
+
(2, 1): "No bus conflicts",
|
|
645
|
+
(2, 2): "AND bus conflicts",
|
|
646
|
+
(3, 0): "Default iNES behaviour",
|
|
647
|
+
(3, 1): "No bus conflicts",
|
|
648
|
+
(3, 2): "AND bus conflicts",
|
|
649
|
+
(7, 0): "Default iNES behaviour",
|
|
650
|
+
(7, 1): "No bus conflicts",
|
|
651
|
+
(7, 2): "AND bus conflicts",
|
|
652
|
+
# MMC3
|
|
653
|
+
(4, 0): "Sharp MMC3",
|
|
654
|
+
(4, 1): "MMC6",
|
|
655
|
+
(4, 2): "MMC3C hard-wired mirroring",
|
|
656
|
+
(4, 3): "MC-ACC",
|
|
657
|
+
(4, 4): "NEC MMC3",
|
|
658
|
+
(4, 5): "T9552 scrambling",
|
|
659
|
+
# Bandai FCG
|
|
660
|
+
(16, 0): "Unspecified (FCG-1/2 + LZ93D50)",
|
|
661
|
+
(16, 1): "LZ93D50 + 24C01 (deprecated, use 159)",
|
|
662
|
+
(16, 2): "Datach (deprecated, use 157)",
|
|
663
|
+
(16, 3): "8 KiB WRAM (deprecated, use 153)",
|
|
664
|
+
(16, 4): "FCG-1/2",
|
|
665
|
+
(16, 5): "LZ93D50 (no/24C02 EEPROM)",
|
|
666
|
+
# Namco 163
|
|
667
|
+
(19, 0): "Default (expansion volume unspecified)",
|
|
668
|
+
(19, 1): "Deprecated (internal battery RAM, no expansion sound)",
|
|
669
|
+
(19, 2): "No expansion sound",
|
|
670
|
+
(19, 3): "N163 sound 11.0–13.0 dB",
|
|
671
|
+
(19, 4): "N163 sound 16.0–17.0 dB",
|
|
672
|
+
(19, 5): "N163 sound 18.0–19.5 dB",
|
|
673
|
+
# VRC2/VRC4
|
|
674
|
+
(21, 0): "Combined addressing (VRC4)",
|
|
675
|
+
(21, 1): "VRC4a",
|
|
676
|
+
(21, 2): "VRC4c",
|
|
677
|
+
(21, 3): "VRC2 (lower addressing)",
|
|
678
|
+
(21, 4): "VRC2 (higher addressing)",
|
|
679
|
+
(23, 0): "Combined addressing (VRC4)",
|
|
680
|
+
(23, 1): "VRC4f",
|
|
681
|
+
(23, 2): "VRC4e",
|
|
682
|
+
(23, 3): "VRC2b",
|
|
683
|
+
(23, 4): "VRC2 (higher addressing)",
|
|
684
|
+
(25, 0): "Combined addressing (VRC4)",
|
|
685
|
+
(25, 1): "VRC4b",
|
|
686
|
+
(25, 2): "VRC4d",
|
|
687
|
+
(25, 3): "VRC2c",
|
|
688
|
+
(25, 4): "VRC2 (higher addressing)",
|
|
689
|
+
# Irem G101
|
|
690
|
+
(32, 0): "Normal (H/V mirroring)",
|
|
691
|
+
(32, 1): "Major League (fixed one-screen)",
|
|
692
|
+
# BNROM / NINA-001
|
|
693
|
+
(34, 0): "Normal (combined)",
|
|
694
|
+
(34, 1): "NINA-001",
|
|
695
|
+
(34, 2): "BNROM",
|
|
696
|
+
# Sunsoft 4
|
|
697
|
+
(68, 0): "Normal",
|
|
698
|
+
(68, 1): "Sunsoft Dual Cartridge System (NTB-ROM)",
|
|
699
|
+
# Codemasters
|
|
700
|
+
(71, 0): "Hardwired H/V mirroring",
|
|
701
|
+
(71, 1): "Fire Hawk (mapper-controlled 1-screen)",
|
|
702
|
+
# Jaleco JF-16 / Cosmo Carrier / Holy Diver
|
|
703
|
+
(78, 0): "Unspecified",
|
|
704
|
+
(78, 1): "Cosmo Carrier (single-screen)",
|
|
705
|
+
(78, 2): "Deprecated",
|
|
706
|
+
(78, 3): "Holy Diver (H/V mirroring)",
|
|
707
|
+
# VRC7
|
|
708
|
+
(85, 0): "Unspecified",
|
|
709
|
+
(85, 1): "VRC7b (Tiny Toon)",
|
|
710
|
+
(85, 2): "VRC7a (Lagrange Point)",
|
|
711
|
+
# Super Fighter III
|
|
712
|
+
(91, 0): "YY830624C/JY830848C",
|
|
713
|
+
(91, 1): "EJ-006-1",
|
|
714
|
+
# Sugar Softec / Hosenkan
|
|
715
|
+
(114, 0): "Lion King / Aladdin scrambling",
|
|
716
|
+
(114, 1): "Boogerman scrambling",
|
|
717
|
+
# Gameinis IR
|
|
718
|
+
(178, 0): "No infrared sensor",
|
|
719
|
+
(178, 1): "Gameinis Infrared Sensor",
|
|
720
|
+
# CNROM security diodes
|
|
721
|
+
(185, 0): "CHR enable bank unknown",
|
|
722
|
+
(185, 4): "CHR enable if latch 0..1 = 0",
|
|
723
|
+
(185, 5): "CHR enable if latch 0..1 = 1",
|
|
724
|
+
(185, 6): "CHR enable if latch 0..1 = 2",
|
|
725
|
+
(185, 7): "CHR enable if latch 0..1 = 3",
|
|
726
|
+
# Namco 118
|
|
727
|
+
(206, 0): "Namcot 118 (normal PRG banking)",
|
|
728
|
+
(206, 1): "Unbanked 32 KiB PRG (3407/3417/3451)",
|
|
729
|
+
# Namco 175/340
|
|
730
|
+
(210, 0): "Unspecified (175 if PRG-RAM/battery else 340)",
|
|
731
|
+
(210, 1): "Namco 175",
|
|
732
|
+
(210, 2): "Namco 340",
|
|
733
|
+
# Sugar Softec 8237
|
|
734
|
+
(215, 0): "UNL-8237",
|
|
735
|
+
(215, 1): "UNL-8237A",
|
|
736
|
+
# Quattro
|
|
737
|
+
(232, 0): "Normal",
|
|
738
|
+
(232, 1): "Aladdin Deck Enhancer",
|
|
739
|
+
# OneBus / VT
|
|
740
|
+
(256, 0): "Normal",
|
|
741
|
+
(256, 1): "Waixing VT03",
|
|
742
|
+
(256, 2): "Power Joy Supermax",
|
|
743
|
+
(256, 3): "Zechess/Hummer Team",
|
|
744
|
+
(256, 4): "Qishenglong",
|
|
745
|
+
(256, 5): "Waixing VT02",
|
|
746
|
+
(256, 11): "Vibes",
|
|
747
|
+
(256, 12): "Cheertone",
|
|
748
|
+
(256, 13): "Taikee",
|
|
749
|
+
(256, 14): "Karaoto",
|
|
750
|
+
(256, 15): "Jungletac",
|
|
751
|
+
# Coolboy / Mindkids
|
|
752
|
+
(268, 0): "Coolboy",
|
|
753
|
+
(268, 1): "Mindkids",
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
def _named_or_unknown(table: Dict[int, str], value: int) -> str:
|
|
758
|
+
name = table.get(value)
|
|
759
|
+
if name is not None:
|
|
760
|
+
return name
|
|
761
|
+
return f"Unknown ({value})"
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
def get_vs_ppu_type_name(value: Optional[int]) -> Optional[str]:
|
|
765
|
+
if value is None:
|
|
766
|
+
return None
|
|
767
|
+
return _named_or_unknown(VS_PPU_TYPES, value)
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
def get_vs_hw_type_name(value: Optional[int]) -> Optional[str]:
|
|
771
|
+
if value is None:
|
|
772
|
+
return None
|
|
773
|
+
return _named_or_unknown(VS_HW_TYPES, value)
|
|
774
|
+
|
|
775
|
+
|
|
776
|
+
def get_extended_console_type_name(value: Optional[int]) -> Optional[str]:
|
|
777
|
+
if value is None:
|
|
778
|
+
return None
|
|
779
|
+
return _named_or_unknown(EXTENDED_CONSOLE_TYPES, value)
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
def get_expansion_device_name(value: Optional[int]) -> Optional[str]:
|
|
783
|
+
if value is None:
|
|
784
|
+
return None
|
|
785
|
+
return _named_or_unknown(EXPANSION_DEVICES, value)
|
|
786
|
+
|
|
787
|
+
|
|
788
|
+
def get_submapper_name(mapper: int, submapper: Optional[int]) -> Optional[str]:
|
|
789
|
+
"""Return a short submapper name, or None if *submapper* is unset."""
|
|
790
|
+
if submapper is None:
|
|
791
|
+
return None
|
|
792
|
+
name = SUBMAPPER_DATABASE.get((mapper, submapper))
|
|
793
|
+
if name is not None:
|
|
794
|
+
return name
|
|
795
|
+
return f"Unknown ({submapper})"
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
def is_known_submapper(mapper: int, submapper: int) -> bool:
|
|
799
|
+
return (mapper, submapper) in SUBMAPPER_DATABASE
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ines-parser
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.4.0
|
|
4
4
|
Summary: Parse iNES/NES 2.0 ROM headers; CLI to scan, export, summarize, and split ROMs
|
|
5
5
|
Author: Leonid Kabanov
|
|
6
6
|
License-Expression: MIT
|
|
@@ -89,7 +89,10 @@ if header and header.is_valid():
|
|
|
89
89
|
|
|
90
90
|
## Docs
|
|
91
91
|
|
|
92
|
-
- `docs/iNES.md`
|
|
92
|
+
- `docs/iNES.md` — iNES header notes
|
|
93
|
+
- `docs/NES2.0.md` — NES 2.0 header layout
|
|
94
|
+
- `docs/List of iNES mappers.md` — mapper and submapper name tables (from `ines_parser/tables.py`)
|
|
95
|
+
- `docs/NES 2.0 lookups.md` — Vs. PPU/hardware, extended console, expansion device names
|
|
93
96
|
- [NESdev iNES](https://www.nesdev.org/wiki/INES)
|
|
94
97
|
- [NESdev NES 2.0](https://www.nesdev.org/wiki/NES_2.0)
|
|
95
98
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|