diff --git a/assets/xml/objects/object_xc.xml b/assets/xml/objects/object_xc.xml
index f6f30b2f44..f08c91cb8d 100644
--- a/assets/xml/objects/object_xc.xml
+++ b/assets/xml/objects/object_xc.xml
@@ -1,146 +1,157 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/assets/xml/objects/object_xc_pal.xml b/assets/xml/objects/object_xc_pal.xml
deleted file mode 100644
index 7d20f23661..0000000000
--- a/assets/xml/objects/object_xc_pal.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/baseroms/gc-eu-mq-dbg/config.yml b/baseroms/gc-eu-mq-dbg/config.yml
index e8465c1bdc..3bcb00ed39 100644
--- a/baseroms/gc-eu-mq-dbg/config.yml
+++ b/baseroms/gc-eu-mq-dbg/config.yml
@@ -816,7 +816,7 @@ assets:
- name: objects/object_wood02
xml_path: assets/xml/objects/object_wood02.xml
- name: objects/object_xc
- xml_path: assets/xml/objects/object_xc_pal.xml
+ xml_path: assets/xml/objects/object_xc.xml
- name: objects/object_yabusame_point
xml_path: assets/xml/objects/object_yabusame_point.xml
- name: objects/object_ydan_objects
diff --git a/baseroms/gc-eu-mq/config.yml b/baseroms/gc-eu-mq/config.yml
index ff709dc9b4..53cfe06642 100644
--- a/baseroms/gc-eu-mq/config.yml
+++ b/baseroms/gc-eu-mq/config.yml
@@ -808,7 +808,7 @@ assets:
- name: objects/object_wood02
xml_path: assets/xml/objects/object_wood02.xml
- name: objects/object_xc
- xml_path: assets/xml/objects/object_xc_pal.xml
+ xml_path: assets/xml/objects/object_xc.xml
- name: objects/object_yabusame_point
xml_path: assets/xml/objects/object_yabusame_point.xml
- name: objects/object_ydan_objects
diff --git a/baseroms/gc-eu/config.yml b/baseroms/gc-eu/config.yml
index ad049d17ff..925144d4ee 100644
--- a/baseroms/gc-eu/config.yml
+++ b/baseroms/gc-eu/config.yml
@@ -808,7 +808,7 @@ assets:
- name: objects/object_wood02
xml_path: assets/xml/objects/object_wood02.xml
- name: objects/object_xc
- xml_path: assets/xml/objects/object_xc_pal.xml
+ xml_path: assets/xml/objects/object_xc.xml
- name: objects/object_yabusame_point
xml_path: assets/xml/objects/object_yabusame_point.xml
- name: objects/object_ydan_objects
diff --git a/baseroms/pal-1.0/config.yml b/baseroms/pal-1.0/config.yml
index 176c3eaacf..b275c032cf 100644
--- a/baseroms/pal-1.0/config.yml
+++ b/baseroms/pal-1.0/config.yml
@@ -820,7 +820,7 @@ assets:
- name: objects/object_wood02
xml_path: assets/xml/objects/object_wood02.xml
- name: objects/object_xc
- xml_path: assets/xml/objects/object_xc_pal.xml
+ xml_path: assets/xml/objects/object_xc.xml
- name: objects/object_yabusame_point
xml_path: assets/xml/objects/object_yabusame_point.xml
- name: objects/object_ydan_objects
diff --git a/baseroms/pal-1.1/config.yml b/baseroms/pal-1.1/config.yml
index 79e02623e9..22a5d478df 100644
--- a/baseroms/pal-1.1/config.yml
+++ b/baseroms/pal-1.1/config.yml
@@ -820,7 +820,7 @@ assets:
- name: objects/object_wood02
xml_path: assets/xml/objects/object_wood02.xml
- name: objects/object_xc
- xml_path: assets/xml/objects/object_xc_pal.xml
+ xml_path: assets/xml/objects/object_xc.xml
- name: objects/object_yabusame_point
xml_path: assets/xml/objects/object_yabusame_point.xml
- name: objects/object_ydan_objects
diff --git a/tools/assets/descriptor/n64resources.py b/tools/assets/descriptor/n64resources.py
index 67a9131818..77616871ca 100644
--- a/tools/assets/descriptor/n64resources.py
+++ b/tools/assets/descriptor/n64resources.py
@@ -160,6 +160,7 @@ def handler_Texture(
"Offset",
"OutName",
"SplitTlut",
+ "Tlut",
"TlutOffset",
"ExternalTlut",
"ExternalTlutOffset",
@@ -181,10 +182,34 @@ def handler_Texture(
res.hack_modes.add("hackmode_split_tlut_false")
assert (
- "TlutOffset" in reselem.attrib or "ExternalTlutOffset" in reselem.attrib
- ), f"CI texture {symbol_name} is missing a tlut offset"
+ "Tlut" in reselem.attrib
+ or "TlutOffset" in reselem.attrib
+ or "ExternalTlutOffset" in reselem.attrib
+ ), f"CI texture {symbol_name} is missing tlut information"
- if "TlutOffset" in reselem.attrib:
+ if "Tlut" in reselem.attrib:
+ xml_errors.check_attrib(
+ reselem,
+ {"Name", "Format", "Width", "Height", "Tlut"},
+ # TODO remove OutName, SplitTlut
+ {"Offset", "OutName", "SplitTlut", "HackMode"} | STATIC_ATTRIB,
+ )
+ tlut_name = reselem.attrib["Tlut"]
+
+ def pass2_callback(pool: ResourcesDescCollectionsPool):
+ matching_tlut_resources = [
+ res for res in collection.resources if res.symbol_name == tlut_name
+ ]
+ assert len(matching_tlut_resources) == 1, (
+ f"Found {len(matching_tlut_resources)} resources named "
+ f"{tlut_name} instead of exactly one"
+ )
+ assert isinstance(
+ matching_tlut_resources[0], TextureResourceDesc
+ ), matching_tlut_resources[0]
+ res.tlut = matching_tlut_resources[0]
+
+ elif "TlutOffset" in reselem.attrib:
xml_errors.check_attrib(
reselem,
{"Name", "Format", "Width", "Height", "TlutOffset"},
diff --git a/tools/assets/descriptor/spec.md b/tools/assets/descriptor/spec.md
index b0a690b0a1..ba8e4853fd 100644
--- a/tools/assets/descriptor/spec.md
+++ b/tools/assets/descriptor/spec.md
@@ -106,6 +106,7 @@ A fixed-point matrix.
```xml
+
```
@@ -113,13 +114,13 @@ A fixed-point matrix.
A texture, an image in one of the native N64 formats.
- Required attributes for all formats: `Format`, `Width`, `Height`
-- Required attributes for CI formats (`ci4`, `ci8`): `TlutOffset`, or `ExternalTlut` and `ExternalTlutOffset`
+- Required attributes for CI formats (`ci4`, `ci8`): `Tlut`, or `TlutOffset`, or `ExternalTlut` and `ExternalTlutOffset`
`Format` is the format of the texture, one of `rgba32`, `rgba16`, `i4`, `i8`, `ia4`, `ia8`, `ia16`, `ci4` or `ci8`.
`Width` and `Height` specify the dimensions of the texture.
-For CI formats, the TLUT (Texture Look Up Table, or palette) must be specified with either `TlutOffset` if the TLUT is in the same file as the texture, or both of `ExternalTlut` and `ExternalTlutOffset` if the TLUT is in a different file. `ExternalTlut` is the name of the baserom file where the TLUT is. In both cases, the TLUT must also be declared as a resource.
+For CI formats, the TLUT (Texture Look Up Table, or palette) must be specified with either `Tlut` or `TlutOffset` if the TLUT is in the same file as the texture, or both of `ExternalTlut` and `ExternalTlutOffset` if the TLUT is in a different file. `ExternalTlut` is the name of the baserom file where the TLUT is. In both cases, the TLUT must also be declared as a resource.
## `Array`