splat64 0.33.1__tar.gz → 0.34.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.
Files changed (150) hide show
  1. {splat64-0.33.1 → splat64-0.34.0}/CHANGELOG.md +7 -0
  2. {splat64-0.33.1 → splat64-0.34.0}/PKG-INFO +2 -2
  3. {splat64-0.33.1 → splat64-0.34.0}/README.md +1 -1
  4. {splat64-0.33.1 → splat64-0.34.0}/docs/Configuration.md +16 -1
  5. {splat64-0.33.1 → splat64-0.34.0}/docs/General-Workflow.md +2 -0
  6. {splat64-0.33.1 → splat64-0.34.0}/pyproject.toml +1 -1
  7. {splat64-0.33.1 → splat64-0.34.0}/src/splat/__init__.py +1 -1
  8. {splat64-0.33.1 → splat64-0.34.0}/src/splat/scripts/split.py +2 -1
  9. splat64-0.34.0/src/splat/segtypes/common/asmtu.py +15 -0
  10. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/c.py +4 -4
  11. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/codesubsegment.py +64 -7
  12. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/segment.py +16 -8
  13. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/options.py +13 -1
  14. splat64-0.33.1/src/splat/segtypes/common/asmtu.py +0 -65
  15. {splat64-0.33.1 → splat64-0.34.0}/.gitattributes +0 -0
  16. {splat64-0.33.1 → splat64-0.34.0}/.github/workflows/black.yml +0 -0
  17. {splat64-0.33.1 → splat64-0.34.0}/.github/workflows/mypy.yml +0 -0
  18. {splat64-0.33.1 → splat64-0.34.0}/.github/workflows/publish_docs_to_wiki.yml +0 -0
  19. {splat64-0.33.1 → splat64-0.34.0}/.github/workflows/pypi.yml +0 -0
  20. {splat64-0.33.1 → splat64-0.34.0}/.github/workflows/test_lib.yml +0 -0
  21. {splat64-0.33.1 → splat64-0.34.0}/.github/workflows/unit_tests.yml +0 -0
  22. {splat64-0.33.1 → splat64-0.34.0}/.gitignore +0 -0
  23. {splat64-0.33.1 → splat64-0.34.0}/LICENSE +0 -0
  24. {splat64-0.33.1 → splat64-0.34.0}/create_config.py +0 -0
  25. {splat64-0.33.1 → splat64-0.34.0}/docs/Adding-Symbols.md +0 -0
  26. {splat64-0.33.1 → splat64-0.34.0}/docs/Advanced.md +0 -0
  27. {splat64-0.33.1 → splat64-0.34.0}/docs/Examples.md +0 -0
  28. {splat64-0.33.1 → splat64-0.34.0}/docs/Home.md +0 -0
  29. {splat64-0.33.1 → splat64-0.34.0}/docs/Quickstart.md +0 -0
  30. {splat64-0.33.1 → splat64-0.34.0}/docs/Segments.md +0 -0
  31. {splat64-0.33.1 → splat64-0.34.0}/docs/VramClasses.md +0 -0
  32. {splat64-0.33.1 → splat64-0.34.0}/mypy.ini +0 -0
  33. {splat64-0.33.1 → splat64-0.34.0}/requirements.txt +0 -0
  34. {splat64-0.33.1 → splat64-0.34.0}/split.py +0 -0
  35. {splat64-0.33.1 → splat64-0.34.0}/src/splat/__main__.py +0 -0
  36. {splat64-0.33.1 → splat64-0.34.0}/src/splat/disassembler/__init__.py +0 -0
  37. {splat64-0.33.1 → splat64-0.34.0}/src/splat/disassembler/disassembler.py +0 -0
  38. {splat64-0.33.1 → splat64-0.34.0}/src/splat/disassembler/disassembler_instance.py +0 -0
  39. {splat64-0.33.1 → splat64-0.34.0}/src/splat/disassembler/disassembler_section.py +0 -0
  40. {splat64-0.33.1 → splat64-0.34.0}/src/splat/disassembler/null_disassembler.py +0 -0
  41. {splat64-0.33.1 → splat64-0.34.0}/src/splat/disassembler/spimdisasm_disassembler.py +0 -0
  42. {splat64-0.33.1 → splat64-0.34.0}/src/splat/platforms/__init__.py +0 -0
  43. {splat64-0.33.1 → splat64-0.34.0}/src/splat/platforms/n64.py +0 -0
  44. {splat64-0.33.1 → splat64-0.34.0}/src/splat/platforms/ps2.py +0 -0
  45. {splat64-0.33.1 → splat64-0.34.0}/src/splat/platforms/psp.py +0 -0
  46. {splat64-0.33.1 → splat64-0.34.0}/src/splat/platforms/psx.py +0 -0
  47. {splat64-0.33.1 → splat64-0.34.0}/src/splat/py.typed +0 -0
  48. {splat64-0.33.1 → splat64-0.34.0}/src/splat/scripts/__init__.py +0 -0
  49. {splat64-0.33.1 → splat64-0.34.0}/src/splat/scripts/capy.py +0 -0
  50. {splat64-0.33.1 → splat64-0.34.0}/src/splat/scripts/create_config.py +0 -0
  51. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/__init__.py +0 -0
  52. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/__init__.py +0 -0
  53. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/asm.py +0 -0
  54. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/bin.py +0 -0
  55. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/bss.py +0 -0
  56. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/code.py +0 -0
  57. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/cpp.py +0 -0
  58. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/data.py +0 -0
  59. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/databin.py +0 -0
  60. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/eh_frame.py +0 -0
  61. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/gcc_except_table.py +0 -0
  62. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/group.py +0 -0
  63. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/hasm.py +0 -0
  64. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/header.py +0 -0
  65. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/lib.py +0 -0
  66. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/linker_offset.py +0 -0
  67. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/pad.py +0 -0
  68. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/rdata.py +0 -0
  69. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/rodata.py +0 -0
  70. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/rodatabin.py +0 -0
  71. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/sbss.py +0 -0
  72. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/sdata.py +0 -0
  73. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/segment.py +0 -0
  74. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/common/textbin.py +0 -0
  75. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/linker_entry.py +0 -0
  76. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/__init__.py +0 -0
  77. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ci.py +0 -0
  78. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ci4.py +0 -0
  79. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ci8.py +0 -0
  80. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/decompressor.py +0 -0
  81. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/gfx.py +0 -0
  82. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/header.py +0 -0
  83. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/i1.py +0 -0
  84. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/i4.py +0 -0
  85. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/i8.py +0 -0
  86. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ia16.py +0 -0
  87. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ia4.py +0 -0
  88. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ia8.py +0 -0
  89. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/img.py +0 -0
  90. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/ipl3.py +0 -0
  91. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/mio0.py +0 -0
  92. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/palette.py +0 -0
  93. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/rgba16.py +0 -0
  94. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/rgba32.py +0 -0
  95. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/rsp.py +0 -0
  96. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/vtx.py +0 -0
  97. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/n64/yay0.py +0 -0
  98. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/ps2/__init__.py +0 -0
  99. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/ps2/ctor.py +0 -0
  100. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/ps2/lit4.py +0 -0
  101. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/ps2/lit8.py +0 -0
  102. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/ps2/vtables.py +0 -0
  103. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/psp/__init__.py +0 -0
  104. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/psx/__init__.py +0 -0
  105. {splat64-0.33.1 → splat64-0.34.0}/src/splat/segtypes/psx/header.py +0 -0
  106. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/__init__.py +0 -0
  107. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/cache_handler.py +0 -0
  108. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/color.py +0 -0
  109. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/compiler.py +0 -0
  110. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/conf.py +0 -0
  111. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/log.py +0 -0
  112. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/n64/__init__.py +0 -0
  113. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/n64/find_code_length.py +0 -0
  114. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/n64/rominfo.py +0 -0
  115. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/palettes.py +0 -0
  116. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/progress_bar.py +0 -0
  117. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/psx/__init__.py +0 -0
  118. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/psx/psxexeinfo.py +0 -0
  119. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/relocs.py +0 -0
  120. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/statistics.py +0 -0
  121. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/symbols.py +0 -0
  122. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/utils.py +0 -0
  123. {splat64-0.33.1 → splat64-0.34.0}/src/splat/util/vram_classes.py +0 -0
  124. {splat64-0.33.1 → splat64-0.34.0}/test/Dockerfile +0 -0
  125. {splat64-0.33.1 → splat64-0.34.0}/test/README.md +0 -0
  126. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/.gitignore +0 -0
  127. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/Makefile +0 -0
  128. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/build/basic_app.bin +0 -0
  129. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/dummy_ipl3.s +0 -0
  130. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/.splache +0 -0
  131. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/data/main.bss.s +0 -0
  132. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/data/main.data.s +0 -0
  133. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/data/main.rodata.s +0 -0
  134. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/handwritten.s +0 -0
  135. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/header.s +0 -0
  136. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/main.s +0 -0
  137. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/nonmatchings/main/D_80000510.s +0 -0
  138. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/nonmatchings/main/func_80000400.s +0 -0
  139. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/asm/nonmatchings/main/func_800004A0.s +0 -0
  140. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/assets/dummy_ipl3.bin +0 -0
  141. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/basic_app.d +0 -0
  142. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/build/test/basic_app/split/src/main.asmproc.d +0 -0
  143. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/src/main.c +0 -0
  144. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/undefined_funcs_auto.txt +0 -0
  145. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/expected/undefined_syms_auto.txt +0 -0
  146. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/handwritten.s +0 -0
  147. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/header.s +0 -0
  148. {splat64-0.33.1 → splat64-0.34.0}/test/basic_app/main.c +0 -0
  149. {splat64-0.33.1 → splat64-0.34.0}/test/test_gen_expected.sh +0 -0
  150. {splat64-0.33.1 → splat64-0.34.0}/test.py +0 -0
@@ -1,5 +1,12 @@
1
1
  # splat Release Notes
2
2
 
3
+ ### 0.34.0
4
+ * Added new global option `is_unsupported_platform`. If enabled, disable checks on platform option.
5
+ * Added new global option `allow_segment_overrides`. If enabled, allows to take precedence over the splat builtin platform segments via splat extension.
6
+
7
+ ### 0.33.2
8
+ * Change `make_full_disasm_for_code` to output other sections for the TU in addition to .text.
9
+
3
10
  ### 0.33.1
4
11
  * Fix `hasm` segments overwriting files already on disk
5
12
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: splat64
3
- Version: 0.33.1
3
+ Version: 0.34.0
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
@@ -76,7 +76,7 @@ The brackets corresponds to the optional dependencies to install while installin
76
76
  If you use a `requirements.txt` file in your repository, then you can add this library with the following line:
77
77
 
78
78
  ```txt
79
- splat64[mips]>=0.33.1,<1.0.0
79
+ splat64[mips]>=0.34.0,<1.0.0
80
80
  ```
81
81
 
82
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.33.1,<1.0.0
24
+ splat64[mips]>=0.34.0,<1.0.0
25
25
  ```
26
26
 
27
27
  ### Optional dependencies
@@ -154,6 +154,21 @@ check_consecutive_segment_types: False
154
154
  ```
155
155
 
156
156
 
157
+ ### is_unsupported_platform
158
+
159
+ Disable checks on `platform` option.
160
+
161
+ Defaults to `False`.
162
+
163
+
164
+ ### allow_segment_overrides
165
+
166
+ Allows to take precedence over the splat builtin platform segments via splat extension.
167
+
168
+ Setting it to `True` tells splat to look for platorm segments in `extensions_path`.
169
+
170
+ Defaults to `False`.
171
+
157
172
  ## Paths
158
173
 
159
174
 
@@ -729,7 +744,7 @@ Don't skip disassembling already matched functions and migrated sections
729
744
 
730
745
  ### make_full_disasm_for_code
731
746
 
732
- Emit a full `.s` file for each `c`/`cpp` segment besides the generated `nonmatchings` individual functions.
747
+ Emit a full `.s` file for each `c`/`cpp` segment containing disassembly of .text and any available sibling sections, in addition to the normally-generated `nonmatchings` individual functions.
733
748
 
734
749
  Can be used to generate "target" or "expected" objects for asm diffing.
735
750
 
@@ -124,6 +124,8 @@ For a GCC example, see the [include.h](https://github.com/AngheloAlf/drmario64/b
124
124
 
125
125
  For IDO, you will need to use [asm-processor](https://github.com/simonlindholm/asm-processor) in order to include assembly code within the c files.
126
126
 
127
+ For MWCC, you will need [mwccgap](https://github.com/mkst/mwccgap) to include assembly code in the c files, similar to asm-processor.
128
+
127
129
  ## Assembly macros
128
130
 
129
131
  splat relies on some assembly macros for the asm generation. They usually live on the `include/macro.inc` file. Without these macros then an assembler would not be able to build our disassemblies.
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
  name = "splat64"
3
3
  # Should be synced with src/splat/__init__.py
4
- version = "0.33.1"
4
+ version = "0.34.0"
5
5
  description = "A binary splitting tool to assist with decompilation and modding projects"
6
6
  readme = "README.md"
7
7
  license = {file = "LICENSE"}
@@ -1,7 +1,7 @@
1
1
  __package_name__ = __name__
2
2
 
3
3
  # Should be synced with pyproject.toml
4
- __version__ = "0.33.1"
4
+ __version__ = "0.34.0"
5
5
  __author__ = "ethteck"
6
6
 
7
7
  from . import util as util
@@ -475,7 +475,8 @@ def main(
475
475
 
476
476
  cache = cache_handler.Cache(config, use_cache, verbose)
477
477
 
478
- initialize_platform(rom_bytes)
478
+ if not options.opts.is_unsupported_platform:
479
+ initialize_platform(rom_bytes)
479
480
 
480
481
  # Initialize segments
481
482
  all_segments = initialize_segments(config["segments"])
@@ -0,0 +1,15 @@
1
+ from .asm import CommonSegAsm
2
+
3
+
4
+ class CommonSegAsmtu(CommonSegAsm):
5
+ def split(self, rom_bytes: bytes):
6
+ if self.rom_start == self.rom_end:
7
+ return
8
+
9
+ if self.spim_section is None:
10
+ return
11
+
12
+ out_path = self.out_path()
13
+ assert out_path is not None, str(self)
14
+
15
+ self.split_as_asmtu_file(out_path)
@@ -250,7 +250,7 @@ class CommonSegC(CommonSegCodeSubsegment):
250
250
  assert func_sym is not None
251
251
 
252
252
  if (
253
- not entry.function.getName() in self.global_asm_funcs
253
+ entry.function.getName() not in self.global_asm_funcs
254
254
  and options.opts.disassemble_all
255
255
  and not is_new_c_file
256
256
  ):
@@ -281,7 +281,7 @@ class CommonSegC(CommonSegCodeSubsegment):
281
281
  section = self.spim_section.get_section()
282
282
  old_value = section.getGpRelHack()
283
283
  section.setGpRelHack(False)
284
- self.split_as_asm_file(self.asm_out_path())
284
+ self.split_as_asmtu_file(self.asm_out_path())
285
285
  section.setGpRelHack(old_value)
286
286
 
287
287
  def get_c_preamble(self):
@@ -304,7 +304,7 @@ class CommonSegC(CommonSegCodeSubsegment):
304
304
 
305
305
  if rodata_sym.vramEnd != next_rodata_sym.vram:
306
306
  log.write(
307
- f"\nA gap was detected in migrated rodata symbols!", status="warn"
307
+ "\nA gap was detected in migrated rodata symbols!", status="warn"
308
308
  )
309
309
  log.write(
310
310
  f"\t In function '{func.getName()}' (0x{func.vram:08X}), gap detected between '{rodata_sym.getName()}' (0x{rodata_sym.vram:08X}) and '{next_rodata_sym.getName()}' (0x{next_rodata_sym.vram:08X})"
@@ -313,7 +313,7 @@ class CommonSegC(CommonSegCodeSubsegment):
313
313
  f"\t The address of the missing rodata symbol is 0x{rodata_sym.vramEnd:08X}"
314
314
  )
315
315
  log.write(
316
- f"\t Try to force the migration of that symbol with `force_migration:True` in the symbol_addrs.txt file; or avoid the migration of symbols around this address with `force_not_migration:True`"
316
+ "\t Try to force the migration of that symbol with `force_migration:True` in the symbol_addrs.txt file; or avoid the migration of symbols around this address with `force_not_migration:True`"
317
317
  )
318
318
 
319
319
  def create_c_asm_file(
@@ -238,12 +238,69 @@ class CommonSegCodeSubsegment(Segment):
238
238
  if self.spim_section is None:
239
239
  return
240
240
 
241
- if out_path:
242
- out_path.parent.mkdir(parents=True, exist_ok=True)
241
+ if not out_path:
242
+ return
243
+
244
+ out_path.parent.mkdir(parents=True, exist_ok=True)
245
+
246
+ self.print_file_boundaries()
247
+
248
+ with open(out_path, "w", newline="\n") as f:
249
+ # Write `.text` contents
250
+ for line in self.get_asm_file_header():
251
+ f.write(line + "\n")
252
+ f.write(self.spim_section.disassemble())
243
253
 
244
- self.print_file_boundaries()
254
+ # Same as above but write all sections from siblings
255
+ def split_as_asmtu_file(self, out_path: Optional[Path]):
256
+ if self.spim_section is None:
257
+ return
258
+
259
+ if not out_path:
260
+ return
245
261
 
246
- with open(out_path, "w", newline="\n") as f:
247
- for line in self.get_asm_file_header():
248
- f.write(line + "\n")
249
- f.write(self.spim_section.disassemble())
262
+ out_path.parent.mkdir(parents=True, exist_ok=True)
263
+
264
+ self.print_file_boundaries()
265
+
266
+ with open(out_path, "w", newline="\n") as f:
267
+ # Write `.text` contents
268
+ for line in self.get_asm_file_header():
269
+ f.write(line + "\n")
270
+ f.write(self.spim_section.disassemble())
271
+
272
+ # Disassemble the siblings to this file by respecting the `section_order`
273
+ for sect in self.section_order:
274
+ if sect == self.get_linker_section_linksection():
275
+ continue
276
+
277
+ sibling = self.siblings.get(sect)
278
+ if sibling is None:
279
+ continue
280
+
281
+ if (
282
+ isinstance(sibling, CommonSegCodeSubsegment)
283
+ and sibling.spim_section is not None
284
+ and not sibling.should_self_split()
285
+ ):
286
+ f.write("\n")
287
+ f.write(f"{sibling.get_section_asm_line()}\n\n")
288
+ f.write(sibling.spim_section.disassemble())
289
+
290
+ # Another loop to check anything that somehow may not be present on the `section_order`
291
+ for sect, sibling in self.siblings.items():
292
+ if sect == self.get_linker_section_linksection():
293
+ continue
294
+
295
+ if sect in self.section_order:
296
+ # Already handled on the above loop
297
+ continue
298
+
299
+ if (
300
+ isinstance(sibling, CommonSegCodeSubsegment)
301
+ and sibling.spim_section is not None
302
+ and not sibling.should_self_split()
303
+ ):
304
+ f.write("\n")
305
+ f.write(f"{sibling.get_section_asm_line()}\n\n")
306
+ f.write(sibling.spim_section.disassemble())
@@ -99,10 +99,21 @@ class Segment:
99
99
  if seg_type.startswith("."):
100
100
  seg_type = seg_type[1:]
101
101
 
102
- segment_class = Segment.get_base_segment_class(seg_type)
103
- if segment_class == None:
104
- # Look in extensions
102
+ if options.opts.allow_segment_overrides:
105
103
  segment_class = Segment.get_extension_segment_class(seg_type)
104
+ if segment_class == None:
105
+ segment_class = Segment.get_base_segment_class(seg_type)
106
+ else:
107
+ segment_class = Segment.get_base_segment_class(seg_type)
108
+ if segment_class == None:
109
+ # Look in extensions
110
+ segment_class = Segment.get_extension_segment_class(seg_type)
111
+
112
+ if segment_class == None:
113
+ log.error(
114
+ f"could not load segment type '{seg_type}'\n(hint: confirm your extension directory is configured correctly)"
115
+ )
116
+
106
117
  return segment_class
107
118
 
108
119
  @staticmethod
@@ -147,11 +158,8 @@ class Segment:
147
158
  ext_mod = importlib.util.module_from_spec(ext_spec)
148
159
  assert ext_spec.loader is not None
149
160
  ext_spec.loader.exec_module(ext_mod)
150
- except Exception as err:
151
- log.write(err, status="error")
152
- log.error(
153
- f"could not load segment type '{seg_type}'\n(hint: confirm your extension directory is configured correctly)"
154
- )
161
+ except Exception:
162
+ return None
155
163
 
156
164
  return getattr(
157
165
  ext_mod, f"{platform.upper()}Seg{seg_type[0].upper()}{seg_type[1:]}"
@@ -41,6 +41,10 @@ class SplatOpts:
41
41
  gp: Optional[int]
42
42
  # Checks and errors if there are any non consecutive segment types
43
43
  check_consecutive_segment_types: bool
44
+ # Disable checks on `platform` option.
45
+ is_unsupported_platform: bool
46
+ # Allows to take precedence over the splat builtin platform segments via splat extension.
47
+ allow_segment_overrides: bool
44
48
 
45
49
  # Paths
46
50
  asset_path: Path
@@ -355,7 +359,13 @@ def _parse_yaml(
355
359
  p = OptParser(yaml)
356
360
 
357
361
  basename = p.parse_opt("basename", str)
358
- platform = p.parse_opt_within("platform", str, ["n64", "psx", "ps2", "psp"])
362
+ is_unsupported_platform = p.parse_opt("is_unsupported_platform", bool, False)
363
+
364
+ if is_unsupported_platform:
365
+ platform = p.parse_opt("platform", str)
366
+ else:
367
+ platform = p.parse_opt_within("platform", str, ["n64", "psx", "ps2", "psp"])
368
+
359
369
  comp = compiler.for_name(p.parse_opt("compiler", str, "IDO"))
360
370
 
361
371
  base_path = Path(
@@ -399,6 +409,8 @@ def _parse_yaml(
399
409
  target_path=p.parse_path(base_path, "target_path"),
400
410
  elf_path=p.parse_optional_path(base_path, "elf_path"),
401
411
  platform=platform,
412
+ is_unsupported_platform=is_unsupported_platform,
413
+ allow_segment_overrides=p.parse_opt("allow_segment_overrides", bool, False),
402
414
  compiler=comp,
403
415
  endianness=parse_endianness(),
404
416
  section_order=p.parse_opt(
@@ -1,65 +0,0 @@
1
- from pathlib import Path
2
- from typing import Optional, TextIO
3
-
4
- from ...util import log, options
5
-
6
- from .asm import CommonSegAsm
7
- from .codesubsegment import CommonSegCodeSubsegment
8
-
9
-
10
- class CommonSegAsmtu(CommonSegAsm):
11
- def split(self, rom_bytes: bytes):
12
- if self.rom_start == self.rom_end:
13
- return
14
-
15
- if self.spim_section is None:
16
- return
17
-
18
- out_path = self.out_path()
19
- assert out_path is not None, str(self)
20
-
21
- out_path.parent.mkdir(parents=True, exist_ok=True)
22
-
23
- self.print_file_boundaries()
24
-
25
- with open(out_path, "w", newline="\n") as f:
26
- # Write `.text` contents
27
- for line in self.get_asm_file_header():
28
- f.write(line + "\n")
29
- f.write(self.spim_section.disassemble())
30
-
31
- # Disassemble the siblings to this file by respecting the `section_order`
32
- for sect in self.section_order:
33
- if sect == self.get_linker_section_linksection():
34
- continue
35
-
36
- sibling = self.siblings.get(sect)
37
- if sibling is None:
38
- continue
39
-
40
- if (
41
- isinstance(sibling, CommonSegCodeSubsegment)
42
- and sibling.spim_section is not None
43
- and not sibling.should_self_split()
44
- ):
45
- f.write("\n")
46
- f.write(f"{sibling.get_section_asm_line()}\n\n")
47
- f.write(sibling.spim_section.disassemble())
48
-
49
- # Another loop to check anything that somehow may not be present on the `section_order`
50
- for sect, sibling in self.siblings.items():
51
- if sect == self.get_linker_section_linksection():
52
- continue
53
-
54
- if sect in self.section_order:
55
- # Already handled on the above loop
56
- continue
57
-
58
- if (
59
- isinstance(sibling, CommonSegCodeSubsegment)
60
- and sibling.spim_section is not None
61
- and not sibling.should_self_split()
62
- ):
63
- f.write("\n")
64
- f.write(f"{sibling.get_section_asm_line()}\n\n")
65
- f.write(sibling.spim_section.disassemble())
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
File without changes