mapfile-parser 2.7.5__tar.gz → 2.8.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.
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/CHANGELOG.md +62 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/Cargo.lock +1 -1
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/Cargo.toml +9 -6
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/PKG-INFO +4 -3
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/README.md +2 -2
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/pyproject.toml +3 -2
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/__init__.py +6 -3
- mapfile_parser-2.8.0/src/mapfile_parser/__main__.py +57 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/bss_check.py +22 -8
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/first_diff.py +27 -11
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/jsonify.py +18 -7
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/pj64_syms.py +17 -4
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/progress.py +24 -9
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/sym_info.py +18 -5
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/symbol_sizes_csv.py +17 -4
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/upload_frogress.py +28 -9
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/mapfile.py +201 -132
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/mapfile_parser.pyi +57 -26
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/mapfile_rs.py +4 -1
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/found_symbol_info.rs +19 -18
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/lib.rs +11 -5
- mapfile_parser-2.8.0/src/rs/mapfile.rs +628 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/maps_comparison_info.rs +23 -23
- mapfile_parser-2.8.0/src/rs/parser.rs +596 -0
- mapfile_parser-2.7.5/src/rs/file.rs → mapfile_parser-2.8.0/src/rs/section.rs +136 -84
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/segment.rs +144 -119
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/symbol.rs +40 -27
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/symbol_comparison_info.rs +14 -14
- mapfile_parser-2.8.0/src/rs/symbol_decomp_state.rs +66 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/utils.rs +8 -4
- mapfile_parser-2.7.5/src/mapfile_parser/__main__.py +0 -34
- mapfile_parser-2.7.5/src/rs/mapfile.rs +0 -1093
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/.gitattributes +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/.gitignore +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/LICENSE +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/__init__.py +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/progress_stats.py +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/progress_stats_rs.py +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/utils.py +0 -0
- {mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/rs/progress_stats.rs +0 -0
|
@@ -7,6 +7,67 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.8.0] - 2025-05-20
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `File::symbol_match_state_iter()` function. Returns an iterator over
|
|
15
|
+
`SymbolDecompState`, which allows to know if a symbol is considered decompiled
|
|
16
|
+
or not decompiled yet.
|
|
17
|
+
- `Section::is_fill`. `true` if the section is a `*fill*` entry.
|
|
18
|
+
- `MapFile::get_every_section_except_section_type`. Provides the same
|
|
19
|
+
functionallity as the old `MapFile::get_every_file_except_section_type`
|
|
20
|
+
function.
|
|
21
|
+
- `Segment::get_every_section_except_section_type`. Provides the same
|
|
22
|
+
functionallity as the old `Segment::get_every_file_except_section_type`
|
|
23
|
+
function.
|
|
24
|
+
- `MapFile::new_from_map_file`, `MapFile::new_from_map_str`,
|
|
25
|
+
`MapFile::new_from_gnu_map_str` and `MapFile::new_from_lld_map_str`.
|
|
26
|
+
- `Symbol::nonmatching_sym_exists`. This will be set to `true` if a symbol with
|
|
27
|
+
the same name but with a `.NON_MATCHING` suffix is found on the same section.
|
|
28
|
+
- The other suffixed symbol (`.NON_MATCHING`) is still retained in the section.
|
|
29
|
+
- The suffixed symbol will have this member set to `false`.
|
|
30
|
+
- Add support for the `decomp.yaml` specification from the
|
|
31
|
+
[`decomp_settings`](https://github.com/ethteck/decomp_settings) project on all
|
|
32
|
+
the provided CLI utilities.
|
|
33
|
+
- If a `decomp.yaml` file is detected, then every CLI argument that can be
|
|
34
|
+
inferred from that file will be be considered optional instead.
|
|
35
|
+
- Most CLI utilites will also add a new optional "version" argument to allow
|
|
36
|
+
picking the version to process from the `decomp.yaml` file. It defaults to
|
|
37
|
+
the first listed version.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Change `Symbol.size` to `u64` from `Option<u64>`.
|
|
42
|
+
- Rename `File` to `Section`.
|
|
43
|
+
- `File` is still available as an alias to `Section`, but it is recommended to
|
|
44
|
+
use the new name instead.
|
|
45
|
+
- Detect `.NON_MATCHING` symbols and fix the size of both the real symbol and
|
|
46
|
+
the `.NON_MATCHING` one during parsing.
|
|
47
|
+
|
|
48
|
+
### Deprecated
|
|
49
|
+
|
|
50
|
+
- `File`. Use `Section` instead.
|
|
51
|
+
- `MapFile::get_every_file_except_section_type`. Use
|
|
52
|
+
`MapFile::get_every_section_except_section_type` instead.
|
|
53
|
+
- `Segment::get_every_file_except_section_type`. Use
|
|
54
|
+
`Segment::get_every_section_except_section_type` instead.
|
|
55
|
+
- `MapFile::new`. Use either `MapFile::new_from_map_file` or
|
|
56
|
+
`MapFile::new_from_map_str` instead.
|
|
57
|
+
- `MapFile::read_map_file`. Use either `MapFile::new_from_map_file` instead.
|
|
58
|
+
- `MapFile::parse_map_contents`. Use either `MapFile::new_from_map_str` instead.
|
|
59
|
+
- `MapFile::parse_map_contents_gnu`. Use either `MapFile::new_from_gnu_map_str`
|
|
60
|
+
instead.
|
|
61
|
+
- `MapFile::parse_map_contents_lld`. Use either `MapFile::new_from_lld_map_str`
|
|
62
|
+
instead.
|
|
63
|
+
- Deprecate `MapFile::fixup_non_matching_symbols` and family. This functionality
|
|
64
|
+
is perform automatically during parsing now.
|
|
65
|
+
- Calling this function is effectively a no-op now.
|
|
66
|
+
|
|
67
|
+
### Fixed
|
|
68
|
+
|
|
69
|
+
- Avoid pointless internal copy during the parsing of GNU mapfiles.
|
|
70
|
+
|
|
10
71
|
## [2.7.5] - 2025-05-08
|
|
11
72
|
|
|
12
73
|
### Fixed
|
|
@@ -468,6 +529,7 @@ Full changes: <https://github.com/Decompollaborate/mapfile_parser/compare/702a73
|
|
|
468
529
|
- Initial release
|
|
469
530
|
|
|
470
531
|
[unreleased]: https://github.com/Decompollaborate/mapfile_parser/compare/master...develop
|
|
532
|
+
[2.8.0]: https://github.com/Decompollaborate/mapfile_parser/compare/2.7.5...2.8.0
|
|
471
533
|
[2.7.5]: https://github.com/Decompollaborate/mapfile_parser/compare/2.7.4...2.7.5
|
|
472
534
|
[2.7.4]: https://github.com/Decompollaborate/mapfile_parser/compare/2.7.3...2.7.4
|
|
473
535
|
[2.7.3]: https://github.com/Decompollaborate/mapfile_parser/compare/2.7.2...2.7.3
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
[package]
|
|
5
5
|
name = "mapfile_parser"
|
|
6
|
-
version = "2.
|
|
6
|
+
version = "2.8.0"
|
|
7
7
|
edition = "2021"
|
|
8
8
|
rust-version = "1.65.0"
|
|
9
9
|
authors = ["Anghelo Carvajal <angheloalf95@gmail.com>"]
|
|
@@ -21,12 +21,15 @@ name = "mapfile_parser"
|
|
|
21
21
|
path = "src/rs/lib.rs"
|
|
22
22
|
crate-type = ["cdylib", "staticlib", "rlib"]
|
|
23
23
|
|
|
24
|
+
[features]
|
|
25
|
+
default = []
|
|
26
|
+
|
|
27
|
+
serde = ["dep:serde"]
|
|
28
|
+
|
|
29
|
+
python_bindings = ["dep:pyo3"]
|
|
30
|
+
|
|
24
31
|
[dependencies]
|
|
25
32
|
regex = "1.10.2"
|
|
26
|
-
pyo3 = { version = "0.23.5", optional = true, features = ["extension-module"]}
|
|
27
33
|
lazy_static = "1.4.0"
|
|
28
34
|
serde = { version = "1.0", features = ["derive"], optional = true }
|
|
29
|
-
|
|
30
|
-
[features]
|
|
31
|
-
python_bindings = ["dep:pyo3"]
|
|
32
|
-
serde = ["dep:serde"]
|
|
35
|
+
pyo3 = { version = "0.23.5", optional = true, features = ["extension-module"]}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapfile_parser
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.8.0
|
|
4
4
|
Classifier: Programming Language :: Rust
|
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
7
7
|
Requires-Dist: requests
|
|
8
|
+
Requires-Dist: decomp-settings==0.0.7
|
|
8
9
|
License-File: LICENSE
|
|
9
10
|
Summary: Map file parser library focusing decompilation projects
|
|
10
11
|
Keywords: mapfile,parser,decomp,decompilation
|
|
@@ -53,7 +54,7 @@ If you use a `requirements.txt` file in your repository, then you can add
|
|
|
53
54
|
this library with the following line:
|
|
54
55
|
|
|
55
56
|
```txt
|
|
56
|
-
mapfile_parser>=2.
|
|
57
|
+
mapfile_parser>=2.8.0,<3.0.0
|
|
57
58
|
```
|
|
58
59
|
|
|
59
60
|
#### Development version
|
|
@@ -92,7 +93,7 @@ cargo add mapfile_parser
|
|
|
92
93
|
Or add the following line manually to your `Cargo.toml` file:
|
|
93
94
|
|
|
94
95
|
```toml
|
|
95
|
-
mapfile_parser = "2.
|
|
96
|
+
mapfile_parser = "2.8.0"
|
|
96
97
|
```
|
|
97
98
|
|
|
98
99
|
## Versioning and changelog
|
|
@@ -35,7 +35,7 @@ If you use a `requirements.txt` file in your repository, then you can add
|
|
|
35
35
|
this library with the following line:
|
|
36
36
|
|
|
37
37
|
```txt
|
|
38
|
-
mapfile_parser>=2.
|
|
38
|
+
mapfile_parser>=2.8.0,<3.0.0
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
#### Development version
|
|
@@ -74,7 +74,7 @@ cargo add mapfile_parser
|
|
|
74
74
|
Or add the following line manually to your `Cargo.toml` file:
|
|
75
75
|
|
|
76
76
|
```toml
|
|
77
|
-
mapfile_parser = "2.
|
|
77
|
+
mapfile_parser = "2.8.0"
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
## Versioning and changelog
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
[project]
|
|
5
5
|
name = "mapfile_parser"
|
|
6
|
-
version = "2.
|
|
6
|
+
version = "2.8.0"
|
|
7
7
|
description = "Map file parser library focusing decompilation projects"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
requires-python = ">=3.9"
|
|
10
10
|
dependencies = [
|
|
11
|
-
"requests"
|
|
11
|
+
"requests",
|
|
12
|
+
"decomp-settings==0.0.7",
|
|
12
13
|
]
|
|
13
14
|
classifiers = [
|
|
14
15
|
"Programming Language :: Rust",
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
from __future__ import annotations
|
|
7
7
|
|
|
8
|
-
__version_info__ = (2,
|
|
9
|
-
__version__ = ".".join(map(str, __version_info__))# + "-dev0"
|
|
8
|
+
__version_info__ = (2, 8, 0)
|
|
9
|
+
__version__ = ".".join(map(str, __version_info__)) # + "-dev0"
|
|
10
10
|
__author__ = "Decompollaborate"
|
|
11
11
|
|
|
12
12
|
from . import utils as utils
|
|
13
13
|
|
|
14
14
|
from .mapfile import MapFile as MapFile
|
|
15
15
|
from .mapfile import Symbol as Symbol
|
|
16
|
-
from .mapfile import
|
|
16
|
+
from .mapfile import Section as Section
|
|
17
17
|
from .mapfile import Segment as Segment
|
|
18
18
|
from .mapfile import FoundSymbolInfo as FoundSymbolInfo
|
|
19
19
|
from .mapfile import SymbolComparisonInfo as SymbolComparisonInfo
|
|
@@ -22,3 +22,6 @@ from .mapfile import MapsComparisonInfo as MapsComparisonInfo
|
|
|
22
22
|
from .progress_stats import ProgressStats as ProgressStats
|
|
23
23
|
|
|
24
24
|
from . import frontends as frontends
|
|
25
|
+
|
|
26
|
+
# Renamed types
|
|
27
|
+
from .mapfile import Section as File
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
|
|
3
|
+
# SPDX-FileCopyrightText: © 2022-2024 Decompollaborate
|
|
4
|
+
# SPDX-License-Identifier: MIT
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
import argparse
|
|
9
|
+
import decomp_settings # type:ignore
|
|
10
|
+
|
|
11
|
+
import mapfile_parser
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def mapfileParserMain():
|
|
15
|
+
try:
|
|
16
|
+
decompConfig = decomp_settings.scan_for_config()
|
|
17
|
+
except:
|
|
18
|
+
decompConfig = None
|
|
19
|
+
|
|
20
|
+
description = description="""\
|
|
21
|
+
Interface to call any of the mapfile_parser's CLI utilities.
|
|
22
|
+
|
|
23
|
+
All the CLI utilities support the `decomp.yaml` specification from the
|
|
24
|
+
[`decomp_settings`](https://github.com/ethteck/decomp_settings) project.
|
|
25
|
+
|
|
26
|
+
If a `decomp.yaml` file is detected, then every CLI argument that can be
|
|
27
|
+
inferred from that file will be be considered optional instead.
|
|
28
|
+
|
|
29
|
+
Most CLI utilites will also add a new optional "version" argument to allow
|
|
30
|
+
picking the version to process from the `decomp.yaml` file. It defaults to the
|
|
31
|
+
first listed version.
|
|
32
|
+
"""
|
|
33
|
+
parser = argparse.ArgumentParser(
|
|
34
|
+
description=description,
|
|
35
|
+
prog="mapfile_parser",
|
|
36
|
+
formatter_class=argparse.RawDescriptionHelpFormatter,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
parser.add_argument("-V", "--version", action="version", version=f"%(prog)s {mapfile_parser.__version__}")
|
|
40
|
+
|
|
41
|
+
subparsers = parser.add_subparsers(description="action", help="the action to perform", required=True)
|
|
42
|
+
|
|
43
|
+
mapfile_parser.frontends.bss_check.addSubparser(subparsers, decompConfig)
|
|
44
|
+
mapfile_parser.frontends.first_diff.addSubparser(subparsers, decompConfig)
|
|
45
|
+
mapfile_parser.frontends.jsonify.addSubparser(subparsers, decompConfig)
|
|
46
|
+
mapfile_parser.frontends.pj64_syms.addSubparser(subparsers, decompConfig)
|
|
47
|
+
mapfile_parser.frontends.progress.addSubparser(subparsers, decompConfig)
|
|
48
|
+
mapfile_parser.frontends.sym_info.addSubparser(subparsers, decompConfig)
|
|
49
|
+
mapfile_parser.frontends.symbol_sizes_csv.addSubparser(subparsers, decompConfig)
|
|
50
|
+
mapfile_parser.frontends.upload_frogress.addSubparser(subparsers, decompConfig)
|
|
51
|
+
|
|
52
|
+
args = parser.parse_args()
|
|
53
|
+
args.func(args, decompConfig)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if __name__ == "__main__":
|
|
57
|
+
mapfileParserMain()
|
|
@@ -13,7 +13,7 @@ from .. import mapfile
|
|
|
13
13
|
from .. import utils
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def getComparison(mapPath
|
|
16
|
+
def getComparison(mapPath, expectedMapPath, *, reverseCheck: bool=True) -> mapfile.MapsComparisonInfo:
|
|
17
17
|
buildMap = mapfile.MapFile()
|
|
18
18
|
buildMap.readMapFile(mapPath)
|
|
19
19
|
buildMap = buildMap.filterBySectionType(".bss")
|
|
@@ -126,7 +126,7 @@ def printFileComparison(comparisonInfo: mapfile.MapsComparisonInfo):
|
|
|
126
126
|
utils.eprint("Some files appear to be missing symbols. Have they been renamed or declared as static? You may need to remake 'expected'")
|
|
127
127
|
|
|
128
128
|
|
|
129
|
-
def doBssCheck(mapPath
|
|
129
|
+
def doBssCheck(mapPath, expectedMapPath, *, printAll: bool=False, reverseCheck: bool=True) -> int:
|
|
130
130
|
if not mapPath.exists():
|
|
131
131
|
utils.eprint(f"{mapPath} must exist")
|
|
132
132
|
return 1
|
|
@@ -147,9 +147,15 @@ def doBssCheck(mapPath: Path, expectedMapPath: Path, *, printAll: bool=False, re
|
|
|
147
147
|
return 0
|
|
148
148
|
|
|
149
149
|
|
|
150
|
-
def processArguments(args: argparse.Namespace):
|
|
151
|
-
|
|
152
|
-
|
|
150
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
151
|
+
if decompConfig is not None:
|
|
152
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
153
|
+
expectedDir = Path(version.paths["expected_dir"])
|
|
154
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
155
|
+
expectedMapPath = args.expectedmap if args.expectedmap is not None else expectedDir / mapPath
|
|
156
|
+
else:
|
|
157
|
+
mapPath = args.mapfile
|
|
158
|
+
expectedMapPath = args.expectedmap
|
|
153
159
|
|
|
154
160
|
printAll: bool = args.print_all
|
|
155
161
|
reverseCheck: bool = not args.no_reverse_check
|
|
@@ -157,11 +163,19 @@ def processArguments(args: argparse.Namespace):
|
|
|
157
163
|
exit(doBssCheck(mapPath, expectedMapPath, printAll=printAll, reverseCheck=reverseCheck))
|
|
158
164
|
|
|
159
165
|
|
|
160
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
166
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
161
167
|
parser = subparser.add_parser("bss_check", help="Check that globally visible bss has not been reordered.")
|
|
162
168
|
|
|
163
|
-
|
|
164
|
-
|
|
169
|
+
nargs: str|int = 1
|
|
170
|
+
if decompConfig is not None:
|
|
171
|
+
nargs = "?"
|
|
172
|
+
versions = []
|
|
173
|
+
for version in decompConfig.versions:
|
|
174
|
+
versions.append(version.name)
|
|
175
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
176
|
+
|
|
177
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
178
|
+
parser.add_argument("expectedmap", help="Path to the map file in the expected dir. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
165
179
|
|
|
166
180
|
parser.add_argument("-a", "--print-all", help="Print all bss, not just non-matching.", action="store_true")
|
|
167
181
|
parser.add_argument("--no-reverse-check", help="Disable looking for symbols on the expected map that are missing on the built map file.", action="store_true")
|
|
@@ -13,7 +13,7 @@ from .. import mapfile
|
|
|
13
13
|
from .. import utils
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
def doFirstDiff(mapPath
|
|
16
|
+
def doFirstDiff(mapPath, expectedMapPath, romPath, expectedRomPath, diffCount: int=5, mismatchSize: bool=False, addColons: bool=True, bytesConverterCallback:Callable[[bytes, mapfile.MapFile],str|None]|None=None, endian: Literal["big", "little"] ="big") -> int:
|
|
17
17
|
if not mapPath.exists():
|
|
18
18
|
print(f"{mapPath} must exist")
|
|
19
19
|
return 1
|
|
@@ -139,11 +139,19 @@ def doFirstDiff(mapPath: Path, expectedMapPath: Path, romPath: Path, expectedRom
|
|
|
139
139
|
return 0
|
|
140
140
|
|
|
141
141
|
|
|
142
|
-
def processArguments(args: argparse.Namespace):
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
143
|
+
if decompConfig is not None:
|
|
144
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
145
|
+
expectedDir = Path(version.paths["expected_dir"])
|
|
146
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
147
|
+
expectedMapPath = args.expectedmap if args.expectedmap is not None else expectedDir / mapPath
|
|
148
|
+
romPath = Path(args.rompath if args.rompath is not None else version.paths.get("build"))
|
|
149
|
+
expectedRomPath = args.expectedrom if args.expectedrom is not None else expectedDir / romPath
|
|
150
|
+
else:
|
|
151
|
+
mapPath = args.mapfile
|
|
152
|
+
expectedMapPath = args.expectedmap
|
|
153
|
+
romPath = args.rompath
|
|
154
|
+
expectedRomPath = args.expectedrom
|
|
147
155
|
|
|
148
156
|
diffCount: int = args.count
|
|
149
157
|
mismatchSize: bool = args.mismatch_size
|
|
@@ -153,13 +161,21 @@ def processArguments(args: argparse.Namespace):
|
|
|
153
161
|
exit(doFirstDiff(mapPath, expectedMapPath, romPath, expectedRomPath, diffCount, mismatchSize, endian=endian))
|
|
154
162
|
|
|
155
163
|
|
|
156
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
164
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
157
165
|
parser = subparser.add_parser("first_diff", help="Find the first difference(s) between the built ROM and the base ROM.")
|
|
158
166
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
167
|
+
nargs: str|int = 1
|
|
168
|
+
if decompConfig is not None:
|
|
169
|
+
nargs = "?"
|
|
170
|
+
versions = []
|
|
171
|
+
for version in decompConfig.versions:
|
|
172
|
+
versions.append(version.name)
|
|
173
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
174
|
+
|
|
175
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
176
|
+
parser.add_argument("expectedmap", help="Path to the map file in the expected dir. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
177
|
+
parser.add_argument("rompath", help="Path to built ROM. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
178
|
+
parser.add_argument("expectedrom", help="Path to the expected ROM. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
163
179
|
|
|
164
180
|
parser.add_argument("-c", "--count", type=int, default=5, help="find up to this many instruction difference(s)")
|
|
165
181
|
parser.add_argument("-m", "--mismatch-size", help="Do not exit early if the ROM sizes does not match", action="store_true")
|
|
@@ -19,8 +19,6 @@ def doJsonify(mapPath: Path, outputPath: Path|None, humanReadable: bool=True, ap
|
|
|
19
19
|
|
|
20
20
|
mapFile = mapfile.MapFile()
|
|
21
21
|
mapFile.readMapFile(mapPath)
|
|
22
|
-
if applyFixes:
|
|
23
|
-
mapFile = mapFile.fixupNonMatchingSymbols()
|
|
24
22
|
|
|
25
23
|
jsonStr = json.dumps(mapFile.toJson(humanReadable=humanReadable), indent=4)
|
|
26
24
|
|
|
@@ -33,20 +31,33 @@ def doJsonify(mapPath: Path, outputPath: Path|None, humanReadable: bool=True, ap
|
|
|
33
31
|
return 0
|
|
34
32
|
|
|
35
33
|
|
|
36
|
-
def processArguments(args: argparse.Namespace):
|
|
37
|
-
|
|
34
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
35
|
+
if decompConfig is not None:
|
|
36
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
37
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
38
|
+
else:
|
|
39
|
+
mapPath = args.mapfile
|
|
40
|
+
|
|
38
41
|
outputPath: Path|None = Path(args.output) if args.output is not None else None
|
|
39
42
|
machine: bool = args.machine
|
|
40
43
|
applyFixes: bool = args.apply_fixes
|
|
41
44
|
|
|
42
45
|
exit(doJsonify(mapPath, outputPath, humanReadable=not machine, applyFixes=applyFixes))
|
|
43
46
|
|
|
44
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
47
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
45
48
|
parser = subparser.add_parser("jsonify", help="Converts a mapfile into a json format.")
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
nargs: str|int = 1
|
|
51
|
+
if decompConfig is not None:
|
|
52
|
+
nargs = "?"
|
|
53
|
+
versions = []
|
|
54
|
+
for version in decompConfig.versions:
|
|
55
|
+
versions.append(version.name)
|
|
56
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
57
|
+
|
|
58
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
48
59
|
parser.add_argument("-o", "--output", help="Output path of for the generated json. If omitted then stdout is used instead.")
|
|
49
60
|
parser.add_argument("-m", "--machine", help="Emit numbers as numbers instead of outputting them as pretty strings.", action="store_true")
|
|
50
|
-
parser.add_argument("-f", "--apply-fixes", help="Apply certain fixups, like fixing size calculation of because of the existence of fake `.NON_MATCHING` symbols.", action="store_true")
|
|
61
|
+
parser.add_argument("-f", "--apply-fixes", help="DEPRECATED, this is applied automatically now. Apply certain fixups, like fixing size calculation of because of the existence of fake `.NON_MATCHING` symbols.", action="store_true")
|
|
51
62
|
|
|
52
63
|
parser.set_defaults(func=processArguments)
|
|
@@ -36,16 +36,29 @@ def doPj64Syms(mapPath: Path, outputPath: Path|None) -> int:
|
|
|
36
36
|
|
|
37
37
|
return 0
|
|
38
38
|
|
|
39
|
-
def processArguments(args: argparse.Namespace):
|
|
40
|
-
|
|
39
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
40
|
+
if decompConfig is not None:
|
|
41
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
42
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
43
|
+
else:
|
|
44
|
+
mapPath = args.mapfile
|
|
45
|
+
|
|
41
46
|
outputPath: Path = args.output
|
|
42
47
|
|
|
43
48
|
exit(doPj64Syms(mapPath, outputPath))
|
|
44
49
|
|
|
45
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
50
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
46
51
|
parser = subparser.add_parser("pj64_syms", help="Produce a PJ64 compatible symbol map.")
|
|
47
52
|
|
|
48
|
-
|
|
53
|
+
nargs: str|int = 1
|
|
54
|
+
if decompConfig is not None:
|
|
55
|
+
nargs = "?"
|
|
56
|
+
versions = []
|
|
57
|
+
for version in decompConfig.versions:
|
|
58
|
+
versions.append(version.name)
|
|
59
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
60
|
+
|
|
61
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
49
62
|
parser.add_argument("output", help="Path to output file. If omitted then output will be written to stdout", type=Path, nargs="?")
|
|
50
63
|
|
|
51
64
|
parser.set_defaults(func=processArguments)
|
|
@@ -19,7 +19,7 @@ def getProgress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, pathIndex:
|
|
|
19
19
|
mapFile.debugging = debugging
|
|
20
20
|
mapFile.readMapFile(mapPath)
|
|
21
21
|
|
|
22
|
-
return mapFile.filterBySectionType(".text").
|
|
22
|
+
return mapFile.filterBySectionType(".text").getProgress(asmPath, nonmatchingsPath, pathIndex=pathIndex, checkFunctionFiles=checkFunctionFiles)
|
|
23
23
|
|
|
24
24
|
def doProgress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, pathIndex: int=2, checkFunctionFiles: bool=True, print_json: bool=False, debugging: bool=False) -> int:
|
|
25
25
|
if not mapPath.exists():
|
|
@@ -40,10 +40,17 @@ def doProgress(mapPath: Path, asmPath: Path, nonmatchingsPath: Path, pathIndex:
|
|
|
40
40
|
return 0
|
|
41
41
|
|
|
42
42
|
|
|
43
|
-
def processArguments(args: argparse.Namespace):
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
44
|
+
if decompConfig is not None:
|
|
45
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
46
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
47
|
+
asmPath = Path(args.asmpath if args.asmpath is not None else version.paths.get("asm"))
|
|
48
|
+
nonmatchingsPath = Path(args.nonmatchingspath if args.nonmatchingspath is not None else version.paths.get("nonmatchings"))
|
|
49
|
+
else:
|
|
50
|
+
mapPath = args.mapfile
|
|
51
|
+
asmPath = args.asmpath
|
|
52
|
+
nonmatchingsPath = args.nonmatchingspath
|
|
53
|
+
|
|
47
54
|
pathIndex: int = args.path_index
|
|
48
55
|
checkFunctionFiles: bool = not args.avoid_function_files
|
|
49
56
|
debugging: bool = args.debugging #! @deprecated
|
|
@@ -51,12 +58,20 @@ def processArguments(args: argparse.Namespace):
|
|
|
51
58
|
|
|
52
59
|
exit(doProgress(mapPath, asmPath, nonmatchingsPath, pathIndex=pathIndex, checkFunctionFiles=checkFunctionFiles, print_json=print_json, debugging=debugging))
|
|
53
60
|
|
|
54
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
61
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
55
62
|
parser = subparser.add_parser("progress", help="Computes current progress of the matched functions. Relies on a splat (https://github.com/ethteck/splat) folder structure and matched functions not longer having a file.")
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
64
|
+
nargs: str|int = 1
|
|
65
|
+
if decompConfig is not None:
|
|
66
|
+
nargs = "?"
|
|
67
|
+
versions = []
|
|
68
|
+
for version in decompConfig.versions:
|
|
69
|
+
versions.append(version.name)
|
|
70
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
71
|
+
|
|
72
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
73
|
+
parser.add_argument("asmpath", help="Path to asm folder. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
74
|
+
parser.add_argument("nonmatchingspath", help="Path to nonmatchings folder. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
60
75
|
parser.add_argument("-i", "--path-index", help="Specify the index to start reading the file paths. Defaults to 2", type=int, default=2)
|
|
61
76
|
parser.add_argument("-f", "--avoid-function-files", help="Avoid checking if the assembly file for a function exists as a way to determine if the function has been matched or not", action="store_true")
|
|
62
77
|
parser.add_argument("-d", "--debugging", help="Enable debugging prints. This option is deprecated", action="store_true")
|
|
@@ -20,7 +20,7 @@ def doSymInfo(mapPath: Path, symName: str, *, as_vram: bool=False, as_vrom: bool
|
|
|
20
20
|
mapFile = mapfile.MapFile()
|
|
21
21
|
mapFile.readMapFile(mapPath)
|
|
22
22
|
|
|
23
|
-
possibleFiles: list[mapfile.
|
|
23
|
+
possibleFiles: list[mapfile.Section] = []
|
|
24
24
|
|
|
25
25
|
if as_vram:
|
|
26
26
|
address = int(symName, 0)
|
|
@@ -52,8 +52,13 @@ def doSymInfo(mapPath: Path, symName: str, *, as_vram: bool=False, as_vrom: bool
|
|
|
52
52
|
return 1
|
|
53
53
|
|
|
54
54
|
|
|
55
|
-
def processArguments(args: argparse.Namespace):
|
|
56
|
-
|
|
55
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
56
|
+
if decompConfig is not None:
|
|
57
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
58
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
59
|
+
else:
|
|
60
|
+
mapPath = args.mapfile
|
|
61
|
+
|
|
57
62
|
symName: str = args.symname
|
|
58
63
|
as_vram: bool = args.vram
|
|
59
64
|
as_vrom: bool = args.vrom
|
|
@@ -61,10 +66,18 @@ def processArguments(args: argparse.Namespace):
|
|
|
61
66
|
|
|
62
67
|
exit(doSymInfo(mapPath, symName, as_vram=as_vram, as_vrom=as_vrom, as_name=as_name))
|
|
63
68
|
|
|
64
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
69
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
65
70
|
parser = subparser.add_parser("sym_info", help="Display various information about a symbol or address.")
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
nargs: str|int = 1
|
|
73
|
+
if decompConfig is not None:
|
|
74
|
+
nargs = "?"
|
|
75
|
+
versions = []
|
|
76
|
+
for version in decompConfig.versions:
|
|
77
|
+
versions.append(version.name)
|
|
78
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
79
|
+
|
|
80
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
68
81
|
parser.add_argument("symname", help="Symbol name or VROM/VRAM address to lookup. How to treat this argument will be guessed.")
|
|
69
82
|
|
|
70
83
|
vram_vrom_group = parser.add_mutually_exclusive_group()
|
{mapfile_parser-2.7.5 → mapfile_parser-2.8.0}/src/mapfile_parser/frontends/symbol_sizes_csv.py
RENAMED
|
@@ -38,8 +38,13 @@ def doSymbolSizesCsv(mapPath: Path, outputPath: Path|None, filterSection: str|No
|
|
|
38
38
|
|
|
39
39
|
return 0
|
|
40
40
|
|
|
41
|
-
def processArguments(args: argparse.Namespace):
|
|
42
|
-
|
|
41
|
+
def processArguments(args: argparse.Namespace, decompConfig=None):
|
|
42
|
+
if decompConfig is not None:
|
|
43
|
+
version = decompConfig.get_version_by_name(args.version)
|
|
44
|
+
mapPath = Path(args.mapfile if args.mapfile is not None else version.paths.get("map"))
|
|
45
|
+
else:
|
|
46
|
+
mapPath = args.mapfile
|
|
47
|
+
|
|
43
48
|
outputPath: Path|None = Path(args.output) if args.output is not None else None
|
|
44
49
|
filterSection: str|None = args.filter_section
|
|
45
50
|
sameFolder: bool = args.same_folder
|
|
@@ -48,10 +53,18 @@ def processArguments(args: argparse.Namespace):
|
|
|
48
53
|
|
|
49
54
|
exit(doSymbolSizesCsv(mapPath, outputPath, filterSection, sameFolder, symbolsSummary, allFiles))
|
|
50
55
|
|
|
51
|
-
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser]):
|
|
56
|
+
def addSubparser(subparser: argparse._SubParsersAction[argparse.ArgumentParser], decompConfig=None):
|
|
52
57
|
parser = subparser.add_parser("symbol_sizes_csv", help="Produces a csv summarizing the files sizes by parsing a map file.")
|
|
53
58
|
|
|
54
|
-
|
|
59
|
+
nargs: str|int = 1
|
|
60
|
+
if decompConfig is not None:
|
|
61
|
+
nargs = "?"
|
|
62
|
+
versions = []
|
|
63
|
+
for version in decompConfig.versions:
|
|
64
|
+
versions.append(version.name)
|
|
65
|
+
parser.add_argument("-v", "--version", help="Version to process from the decomp.yaml file", type=str, choices=versions, default=versions[0])
|
|
66
|
+
|
|
67
|
+
parser.add_argument("mapfile", help="Path to a map file. This argument is optional if an `decomp.yaml` file is detected on the current project.", type=Path, nargs=nargs)
|
|
55
68
|
parser.add_argument("-o", "--output", help="Output path of for the generated csv. If omitted then stdout is used instead.")
|
|
56
69
|
parser.add_argument("--same-folder", help="Mix files in the same folder.", action="store_true")
|
|
57
70
|
parser.add_argument("--symbols", help="Prints the size of every symbol instead of a summary.", action="store_true")
|