splat64 0.32.0__tar.gz → 0.32.2__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.
Files changed (143) hide show
  1. {splat64-0.32.0 → splat64-0.32.2}/CHANGELOG.md +9 -0
  2. {splat64-0.32.0 → splat64-0.32.2}/PKG-INFO +6 -5
  3. {splat64-0.32.0 → splat64-0.32.2}/README.md +1 -1
  4. {splat64-0.32.0 → splat64-0.32.2}/pyproject.toml +5 -2
  5. {splat64-0.32.0 → splat64-0.32.2}/requirements.txt +1 -1
  6. {splat64-0.32.0 → splat64-0.32.2}/src/splat/__init__.py +1 -1
  7. {splat64-0.32.0 → splat64-0.32.2}/src/splat/disassembler/spimdisasm_disassembler.py +1 -1
  8. {splat64-0.32.0 → splat64-0.32.2}/src/splat/scripts/split.py +6 -6
  9. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/bin.py +8 -1
  10. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/codesubsegment.py +1 -1
  11. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/data.py +10 -0
  12. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/group.py +9 -1
  13. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/rodata.py +10 -0
  14. splat64-0.32.2/src/splat/segtypes/common/segment.py +5 -0
  15. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/segment.py +34 -0
  16. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/statistics.py +4 -4
  17. splat64-0.32.0/src/splat/segtypes/common/segment.py +0 -5
  18. {splat64-0.32.0 → splat64-0.32.2}/.github/workflows/black.yml +0 -0
  19. {splat64-0.32.0 → splat64-0.32.2}/.github/workflows/mypy.yml +0 -0
  20. {splat64-0.32.0 → splat64-0.32.2}/.github/workflows/publish_docs_to_wiki.yml +0 -0
  21. {splat64-0.32.0 → splat64-0.32.2}/.github/workflows/pypi.yml +0 -0
  22. {splat64-0.32.0 → splat64-0.32.2}/.github/workflows/test_lib.yml +0 -0
  23. {splat64-0.32.0 → splat64-0.32.2}/.github/workflows/unit_tests.yml +0 -0
  24. {splat64-0.32.0 → splat64-0.32.2}/.gitignore +0 -0
  25. {splat64-0.32.0 → splat64-0.32.2}/LICENSE +0 -0
  26. {splat64-0.32.0 → splat64-0.32.2}/create_config.py +0 -0
  27. {splat64-0.32.0 → splat64-0.32.2}/docs/Adding-Symbols.md +0 -0
  28. {splat64-0.32.0 → splat64-0.32.2}/docs/Advanced.md +0 -0
  29. {splat64-0.32.0 → splat64-0.32.2}/docs/Configuration.md +0 -0
  30. {splat64-0.32.0 → splat64-0.32.2}/docs/Examples.md +0 -0
  31. {splat64-0.32.0 → splat64-0.32.2}/docs/General-Workflow.md +0 -0
  32. {splat64-0.32.0 → splat64-0.32.2}/docs/Home.md +0 -0
  33. {splat64-0.32.0 → splat64-0.32.2}/docs/Quickstart.md +0 -0
  34. {splat64-0.32.0 → splat64-0.32.2}/docs/Segments.md +0 -0
  35. {splat64-0.32.0 → splat64-0.32.2}/docs/VramClasses.md +0 -0
  36. {splat64-0.32.0 → splat64-0.32.2}/mypy.ini +0 -0
  37. {splat64-0.32.0 → splat64-0.32.2}/split.py +0 -0
  38. {splat64-0.32.0 → splat64-0.32.2}/src/splat/__main__.py +0 -0
  39. {splat64-0.32.0 → splat64-0.32.2}/src/splat/disassembler/__init__.py +0 -0
  40. {splat64-0.32.0 → splat64-0.32.2}/src/splat/disassembler/disassembler.py +0 -0
  41. {splat64-0.32.0 → splat64-0.32.2}/src/splat/disassembler/disassembler_instance.py +0 -0
  42. {splat64-0.32.0 → splat64-0.32.2}/src/splat/disassembler/disassembler_section.py +0 -0
  43. {splat64-0.32.0 → splat64-0.32.2}/src/splat/disassembler/null_disassembler.py +0 -0
  44. {splat64-0.32.0 → splat64-0.32.2}/src/splat/platforms/__init__.py +0 -0
  45. {splat64-0.32.0 → splat64-0.32.2}/src/splat/platforms/n64.py +0 -0
  46. {splat64-0.32.0 → splat64-0.32.2}/src/splat/platforms/ps2.py +0 -0
  47. {splat64-0.32.0 → splat64-0.32.2}/src/splat/platforms/psp.py +0 -0
  48. {splat64-0.32.0 → splat64-0.32.2}/src/splat/platforms/psx.py +0 -0
  49. {splat64-0.32.0 → splat64-0.32.2}/src/splat/py.typed +0 -0
  50. {splat64-0.32.0 → splat64-0.32.2}/src/splat/scripts/__init__.py +0 -0
  51. {splat64-0.32.0 → splat64-0.32.2}/src/splat/scripts/capy.py +0 -0
  52. {splat64-0.32.0 → splat64-0.32.2}/src/splat/scripts/create_config.py +0 -0
  53. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/__init__.py +0 -0
  54. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/__init__.py +0 -0
  55. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/asm.py +0 -0
  56. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/asmtu.py +0 -0
  57. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/bss.py +0 -0
  58. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/c.py +0 -0
  59. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/code.py +0 -0
  60. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/cpp.py +0 -0
  61. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/databin.py +0 -0
  62. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/eh_frame.py +0 -0
  63. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/gcc_except_table.py +0 -0
  64. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/hasm.py +0 -0
  65. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/header.py +0 -0
  66. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/lib.py +0 -0
  67. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/linker_offset.py +0 -0
  68. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/pad.py +0 -0
  69. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/rdata.py +0 -0
  70. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/rodatabin.py +0 -0
  71. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/sbss.py +0 -0
  72. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/sdata.py +0 -0
  73. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/common/textbin.py +0 -0
  74. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/linker_entry.py +0 -0
  75. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/__init__.py +0 -0
  76. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ci.py +0 -0
  77. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ci4.py +0 -0
  78. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ci8.py +0 -0
  79. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/decompressor.py +0 -0
  80. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/gfx.py +0 -0
  81. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/header.py +0 -0
  82. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/i1.py +0 -0
  83. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/i4.py +0 -0
  84. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/i8.py +0 -0
  85. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ia16.py +0 -0
  86. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ia4.py +0 -0
  87. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ia8.py +0 -0
  88. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/img.py +0 -0
  89. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/ipl3.py +0 -0
  90. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/mio0.py +0 -0
  91. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/palette.py +0 -0
  92. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/rgba16.py +0 -0
  93. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/rgba32.py +0 -0
  94. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/rsp.py +0 -0
  95. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/vtx.py +0 -0
  96. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/n64/yay0.py +0 -0
  97. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/ps2/__init__.py +0 -0
  98. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/ps2/ctor.py +0 -0
  99. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/ps2/lit4.py +0 -0
  100. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/ps2/lit8.py +0 -0
  101. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/ps2/vtables.py +0 -0
  102. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/psp/__init__.py +0 -0
  103. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/psx/__init__.py +0 -0
  104. {splat64-0.32.0 → splat64-0.32.2}/src/splat/segtypes/psx/header.py +0 -0
  105. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/__init__.py +0 -0
  106. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/cache_handler.py +0 -0
  107. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/color.py +0 -0
  108. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/compiler.py +0 -0
  109. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/log.py +0 -0
  110. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/n64/__init__.py +0 -0
  111. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/n64/find_code_length.py +0 -0
  112. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/n64/rominfo.py +0 -0
  113. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/options.py +0 -0
  114. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/palettes.py +0 -0
  115. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/progress_bar.py +0 -0
  116. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/psx/__init__.py +0 -0
  117. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/psx/psxexeinfo.py +0 -0
  118. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/relocs.py +0 -0
  119. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/symbols.py +0 -0
  120. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/utils.py +0 -0
  121. {splat64-0.32.0 → splat64-0.32.2}/src/splat/util/vram_classes.py +0 -0
  122. {splat64-0.32.0 → splat64-0.32.2}/test/Dockerfile +0 -0
  123. {splat64-0.32.0 → splat64-0.32.2}/test/README.md +0 -0
  124. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/.gitignore +0 -0
  125. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/Makefile +0 -0
  126. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/dummy_ipl3.s +0 -0
  127. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/.splache +0 -0
  128. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/data/main.bss.s +0 -0
  129. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/data/main.data.s +0 -0
  130. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/handwritten.s +0 -0
  131. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/header.s +0 -0
  132. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/nonmatchings/main/D_80000510.s +0 -0
  133. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/nonmatchings/main/func_80000400.s +0 -0
  134. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/asm/nonmatchings/main/func_800004A0.s +0 -0
  135. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/assets/dummy_ipl3.bin +0 -0
  136. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/src/main.c +0 -0
  137. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/undefined_funcs_auto.txt +0 -0
  138. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/expected/undefined_syms_auto.txt +0 -0
  139. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/handwritten.s +0 -0
  140. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/header.s +0 -0
  141. {splat64-0.32.0 → splat64-0.32.2}/test/basic_app/main.c +0 -0
  142. {splat64-0.32.0 → splat64-0.32.2}/test/test_gen_expected.sh +0 -0
  143. {splat64-0.32.0 → splat64-0.32.2}/test.py +0 -0
@@ -1,5 +1,14 @@
1
1
  # splat Release Notes
2
2
 
3
+ ### 0.32.2
4
+
5
+ * Fix jumptable labels not being properly formatted with the given `symbol_name_format`.
6
+ * `spimdisasm` 1.32.0 or above is now required.
7
+
8
+ ### 0.32.1
9
+
10
+ * Include subsegment information when aggregating split statistics.
11
+
3
12
  ### 0.32.0
4
13
 
5
14
  * Tag `PSYQ` as a compiler that uses `j` instructions as branches.
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.4
2
2
  Name: splat64
3
- Version: 0.32.0
3
+ Version: 0.32.2
4
4
  Summary: A binary splitting tool to assist with decompilation and modding projects
5
5
  Project-URL: Repository, https://github.com/ethteck/splat
6
6
  Project-URL: Issues, https://github.com/ethteck/splat/issues
@@ -26,6 +26,7 @@ License: MIT License
26
26
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
27
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
28
  SOFTWARE.
29
+ License-File: LICENSE
29
30
  Classifier: License :: OSI Approved :: MIT License
30
31
  Classifier: Programming Language :: Python :: 3
31
32
  Requires-Python: >=3.9
@@ -41,7 +42,7 @@ Requires-Dist: mypy; extra == 'dev'
41
42
  Requires-Dist: n64img>=0.3.3; extra == 'dev'
42
43
  Requires-Dist: pygfxd; extra == 'dev'
43
44
  Requires-Dist: rabbitizer<2.0.0,>=1.12.0; extra == 'dev'
44
- Requires-Dist: spimdisasm<2.0.0,>=1.31.0; extra == 'dev'
45
+ Requires-Dist: spimdisasm<2.0.0,>=1.32.0; extra == 'dev'
45
46
  Requires-Dist: types-colorama; extra == 'dev'
46
47
  Requires-Dist: types-pyyaml; extra == 'dev'
47
48
  Provides-Extra: mips
@@ -49,7 +50,7 @@ Requires-Dist: crunch64<1.0.0,>=0.5.1; extra == 'mips'
49
50
  Requires-Dist: n64img>=0.3.3; extra == 'mips'
50
51
  Requires-Dist: pygfxd; extra == 'mips'
51
52
  Requires-Dist: rabbitizer<2.0.0,>=1.12.0; extra == 'mips'
52
- Requires-Dist: spimdisasm<2.0.0,>=1.31.0; extra == 'mips'
53
+ Requires-Dist: spimdisasm<2.0.0,>=1.32.0; extra == 'mips'
53
54
  Description-Content-Type: text/markdown
54
55
 
55
56
  # splat
@@ -75,7 +76,7 @@ The brackets corresponds to the optional dependencies to install while installin
75
76
  If you use a `requirements.txt` file in your repository, then you can add this library with the following line:
76
77
 
77
78
  ```txt
78
- splat64[mips]>=0.32.0,<1.0.0
79
+ splat64[mips]>=0.32.2,<1.0.0
79
80
  ```
80
81
 
81
82
  ### Optional dependencies
@@ -21,7 +21,7 @@ The brackets corresponds to the optional dependencies to install while installin
21
21
  If you use a `requirements.txt` file in your repository, then you can add this library with the following line:
22
22
 
23
23
  ```txt
24
- splat64[mips]>=0.32.0,<1.0.0
24
+ splat64[mips]>=0.32.2,<1.0.0
25
25
  ```
26
26
 
27
27
  ### Optional dependencies
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "splat64"
3
3
  # Should be synced with src/splat/__init__.py
4
- version = "0.32.0"
4
+ version = "0.32.2"
5
5
  description = "A binary splitting tool to assist with decompilation and modding projects"
6
6
  readme = "README.md"
7
7
  license = {file = "LICENSE"}
@@ -20,7 +20,7 @@ dependencies = [
20
20
 
21
21
  [project.optional-dependencies]
22
22
  mips = [
23
- "spimdisasm>=1.31.0,<2.0.0", # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py
23
+ "spimdisasm>=1.32.0,<2.0.0", # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py
24
24
  "rabbitizer>=1.12.0,<2.0.0",
25
25
  "pygfxd",
26
26
  "n64img>=0.3.3",
@@ -46,5 +46,8 @@ build-backend = "hatchling.build"
46
46
  [tool.hatch.build.targets.wheel]
47
47
  packages = ["src/splat"]
48
48
 
49
+ [tool.hatch.envs.dev]
50
+ features = ["dev"]
51
+
49
52
  [project.scripts]
50
53
  splat = "splat.__main__:splat_main"
@@ -4,7 +4,7 @@ tqdm
4
4
  intervaltree
5
5
  colorama
6
6
  # This value should be keep in sync with the version listed on disassembler/spimdisasm_disassembler.py and pyproject.toml
7
- spimdisasm>=1.31.0
7
+ spimdisasm>=1.32.0
8
8
  rabbitizer>=1.10.0
9
9
  pygfxd
10
10
  n64img>=0.1.4
@@ -1,7 +1,7 @@
1
1
  __package_name__ = __name__
2
2
 
3
3
  # Should be synced with pyproject.toml
4
- __version__ = "0.32.0"
4
+ __version__ = "0.32.2"
5
5
  __author__ = "ethteck"
6
6
 
7
7
  from . import util as util
@@ -7,7 +7,7 @@ from typing import Set
7
7
 
8
8
  class SpimdisasmDisassembler(disassembler.Disassembler):
9
9
  # This value should be kept in sync with the version listed on requirements.txt and pyproject.toml
10
- SPIMDISASM_MIN = (1, 31, 0)
10
+ SPIMDISASM_MIN = (1, 32, 0)
11
11
 
12
12
  def configure(self):
13
13
  # Configure spimdisasm
@@ -271,11 +271,9 @@ def do_scan(
271
271
  for segment in scan_bar:
272
272
  assert isinstance(segment, Segment)
273
273
  scan_bar.set_description(f"Scanning {brief_seg_name(segment, 20)}")
274
- typ = segment.type
275
- if segment.type == "bin" and segment.is_name_default():
276
- typ = "unk"
277
274
 
278
- stats.add_size(typ, segment.size)
275
+ for ty, sub_stats in segment.statistics.items():
276
+ stats.add_size(ty, sub_stats.size)
279
277
 
280
278
  if segment.should_scan():
281
279
  # Check cache but don't write anything
@@ -287,7 +285,8 @@ def do_scan(
287
285
 
288
286
  processed_segments.append(segment)
289
287
 
290
- stats.count_split(typ)
288
+ for ty, sub_stats in segment.statistics.items():
289
+ stats.count_split(ty, sub_stats.count)
291
290
 
292
291
  symbols.mark_c_funcs_as_defined()
293
292
  return processed_segments
@@ -305,7 +304,8 @@ def do_split(
305
304
  split_bar.set_description(f"Splitting {brief_seg_name(segment, 20)}")
306
305
 
307
306
  if cache.check_cache_hit(segment, True):
308
- stats.count_cached(segment.type)
307
+ for ty, sub_stats in segment.statistics.items():
308
+ stats.count_cached(ty, sub_stats.count)
309
309
  continue
310
310
 
311
311
  if segment.should_split():
@@ -3,7 +3,7 @@ from typing import Optional
3
3
 
4
4
  from ...util import log, options
5
5
 
6
- from .segment import CommonSegment
6
+ from .segment import CommonSegment, SegmentType
7
7
 
8
8
 
9
9
  class CommonSegBin(CommonSegment):
@@ -33,3 +33,10 @@ class CommonSegBin(CommonSegment):
33
33
 
34
34
  f.write(rom_bytes[self.rom_start : self.rom_end])
35
35
  self.log(f"Wrote {self.name} to {path}")
36
+
37
+ @property
38
+ def statistics_type(self) -> SegmentType:
39
+ stats_type = self.type
40
+ if self.is_name_default():
41
+ stats_type = "unk"
42
+ return stats_type
@@ -122,7 +122,7 @@ class CommonSegCodeSubsegment(Segment):
122
122
  )
123
123
 
124
124
  # Gather symbols found by spimdisasm and create those symbols in splat's side
125
- for referenced_vram in func_spim.instrAnalyzer.referencedVrams:
125
+ for referenced_vram in func_spim.referencedVrams:
126
126
  context_sym = self.spim_section.get_section().getSymbol(
127
127
  referenced_vram, tryPlusOffset=False
128
128
  )
@@ -145,6 +145,16 @@ class CommonSegData(CommonSegCodeSubsegment, CommonSegGroup):
145
145
  self.get_most_parent(), symbol.contextSym
146
146
  )
147
147
 
148
+ # Gather symbols found by spimdisasm and create those symbols in splat's side
149
+ for referenced_vram in symbol.referencedVrams:
150
+ context_sym = self.spim_section.get_section().getSymbol(
151
+ referenced_vram, tryPlusOffset=False
152
+ )
153
+ if context_sym is not None:
154
+ symbols.create_symbol_from_spim_symbol(
155
+ self.get_most_parent(), context_sym
156
+ )
157
+
148
158
  # Hint to the user that we are now in the .rodata section and no longer in the .data section (assuming rodata follows data)
149
159
  if (
150
160
  self.suggestion_rodata_section_start
@@ -3,7 +3,7 @@ from typing import List, Optional
3
3
  from ...util import log
4
4
 
5
5
  from .segment import CommonSegment
6
- from ..segment import Segment
6
+ from ..segment import empty_statistics, Segment, SegmentStatistics
7
7
 
8
8
 
9
9
  class CommonSegGroup(CommonSegment):
@@ -124,6 +124,14 @@ class CommonSegGroup(CommonSegment):
124
124
  return True
125
125
  return False
126
126
 
127
+ @property
128
+ def statistics(self) -> SegmentStatistics:
129
+ stats = empty_statistics()
130
+ for sub in self.subsegments:
131
+ for ty, info in sub.statistics.items():
132
+ stats[ty] = stats[ty].merge(info)
133
+ return stats
134
+
127
135
  def get_linker_entries(self):
128
136
  return [entry for sub in self.subsegments for entry in sub.get_linker_entries()]
129
137
 
@@ -112,6 +112,16 @@ class CommonSegRodata(CommonSegData):
112
112
  )
113
113
  generated_symbol.linker_section = self.get_linker_section_linksection()
114
114
 
115
+ # Gather symbols found by spimdisasm and create those symbols in splat's side
116
+ for referenced_vram in symbol.referencedVrams:
117
+ context_sym = self.spim_section.get_section().getSymbol(
118
+ referenced_vram, tryPlusOffset=False
119
+ )
120
+ if context_sym is not None:
121
+ symbols.create_symbol_from_spim_symbol(
122
+ self.get_most_parent(), context_sym
123
+ )
124
+
115
125
  possible_text = self.get_possible_text_subsegment_for_symbol(symbol)
116
126
  if possible_text is not None:
117
127
  text_segment, refenceeFunction = possible_text
@@ -0,0 +1,5 @@
1
+ from ...segtypes.segment import Segment, SegmentType
2
+
3
+
4
+ class CommonSegment(Segment):
5
+ pass
@@ -1,3 +1,5 @@
1
+ import collections
2
+ import dataclasses
1
3
  import importlib
2
4
  import importlib.util
3
5
  from pathlib import Path
@@ -67,6 +69,27 @@ def parse_segment_section_order(segment: Union[dict, list]) -> List[str]:
67
69
  return default
68
70
 
69
71
 
72
+ SegmentType = str
73
+
74
+
75
+ @dataclasses.dataclass
76
+ class SegmentStatisticsInfo:
77
+ size: int
78
+ count: int
79
+
80
+ def merge(self, other: "SegmentStatisticsInfo") -> "SegmentStatisticsInfo":
81
+ return SegmentStatisticsInfo(
82
+ size=self.size + other.size, count=self.count + other.count
83
+ )
84
+
85
+
86
+ SegmentStatistics = dict[SegmentType, SegmentStatisticsInfo]
87
+
88
+
89
+ def empty_statistics() -> SegmentStatistics:
90
+ return collections.defaultdict(lambda: SegmentStatisticsInfo(size=0, count=0))
91
+
92
+
70
93
  class Segment:
71
94
  require_unique_name = True
72
95
 
@@ -520,6 +543,17 @@ class Segment:
520
543
  else:
521
544
  return None
522
545
 
546
+ @property
547
+ def statistics(self) -> SegmentStatistics:
548
+ stats = empty_statistics()
549
+ if self.size is not None:
550
+ stats[self.statistics_type] = SegmentStatisticsInfo(size=self.size, count=1)
551
+ return stats
552
+
553
+ @property
554
+ def statistics_type(self) -> SegmentType:
555
+ return self.type
556
+
523
557
  @property
524
558
  def vram_end(self) -> Optional[int]:
525
559
  if self.vram_start is not None and self.size is not None:
@@ -24,15 +24,15 @@ class Statistics:
24
24
  self.seg_sizes[typ] = 0
25
25
  self.seg_sizes[typ] += 0 if size is None else size
26
26
 
27
- def count_split(self, typ: str):
27
+ def count_split(self, typ: str, count: int = 1):
28
28
  if typ not in self.seg_split:
29
29
  self.seg_split[typ] = 0
30
- self.seg_split[typ] += 1
30
+ self.seg_split[typ] += count
31
31
 
32
- def count_cached(self, typ: str):
32
+ def count_cached(self, typ: str, count: int = 1):
33
33
  if typ not in self.seg_cached:
34
34
  self.seg_cached[typ] = 0
35
- self.seg_cached[typ] += 1
35
+ self.seg_cached[typ] += count
36
36
 
37
37
  def print_statistics(self, total_size: int):
38
38
  unk_size = self.seg_sizes.get("unk", 0)
@@ -1,5 +0,0 @@
1
- from ...segtypes.segment import Segment
2
-
3
-
4
- class CommonSegment(Segment):
5
- pass
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
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
File without changes