mirror of https://github.com/zeldaret/oot.git
Add `conf.EXPLICIT_SIZES = True` for making some array resources declare and define with explicit length
This commit is contained in:
parent
f456bc6bf8
commit
b9cb07f4bc
|
@ -1,2 +1,3 @@
|
|||
WRITE_HINTS = True
|
||||
I_D_OMEGALUL = True # IDO specific things that may be otherwise different
|
||||
EXPLICIT_SIZES = True
|
||||
|
|
|
@ -9,6 +9,8 @@ from typing import TYPE_CHECKING, Callable, Any, Sequence, Union
|
|||
if TYPE_CHECKING:
|
||||
from .memorymap import MemoryContext
|
||||
|
||||
from ...conf import EXPLICIT_SIZES
|
||||
|
||||
from . import (
|
||||
RESOURCE_PARSE_SUCCESS,
|
||||
Resource,
|
||||
|
@ -456,7 +458,7 @@ class S16ArrayResource(CDataResource):
|
|||
super().__init__(file, range_start, name)
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"s16 {self.symbol_name}[{self.cdata_ext.size // self.elem_cdata_ext.size}]"
|
||||
return f"s16 {self.symbol_name}[]"
|
||||
|
||||
|
|
|
@ -6,6 +6,8 @@ from typing import TYPE_CHECKING, Optional
|
|||
if TYPE_CHECKING:
|
||||
from ..extase.memorymap import MemoryContext
|
||||
|
||||
from ...conf import EXPLICIT_SIZES
|
||||
|
||||
from ..extase import (
|
||||
File,
|
||||
RESOURCE_PARSE_SUCCESS,
|
||||
|
@ -41,7 +43,7 @@ class CollisionVtxListResource(CDataResource):
|
|||
super().__init__(file, range_start, name)
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"Vec3s {self.symbol_name}[{self.cdata_ext.length}]"
|
||||
return f"Vec3s {self.symbol_name}[]"
|
||||
|
||||
|
@ -160,7 +162,7 @@ class CollisionPolyListResource(CDataResource):
|
|||
return RESOURCE_PARSE_SUCCESS
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"CollisionPoly {self.symbol_name}[{self.cdata_ext.length}]"
|
||||
return f"CollisionPoly {self.symbol_name}[]"
|
||||
|
||||
|
@ -291,7 +293,7 @@ class CollisionSurfaceTypeListResource(CDataResource):
|
|||
return RESOURCE_PARSE_SUCCESS
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"SurfaceType {self.symbol_name}[{self.cdata_ext.length}]"
|
||||
return f"SurfaceType {self.symbol_name}[]"
|
||||
|
||||
|
@ -317,7 +319,7 @@ class BgCamFuncDataResource(CDataResource):
|
|||
super().__init__(file, range_start, name)
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"Vec3s {self.symbol_name}[{self.cdata_ext.length}]"
|
||||
return f"Vec3s {self.symbol_name}[]"
|
||||
|
||||
|
@ -418,7 +420,7 @@ class CollisionBgCamListResource(CDataResource):
|
|||
return RESOURCE_PARSE_SUCCESS
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"BgCamInfo {self.symbol_name}[{self.cdata_ext.length}]"
|
||||
return f"BgCamInfo {self.symbol_name}[]"
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@ from ..extase.cdata_resources import (
|
|||
fmt_hex_u,
|
||||
)
|
||||
|
||||
from ...conf import EXPLICIT_SIZES
|
||||
|
||||
BEST_EFFORT = True
|
||||
|
||||
|
@ -150,7 +151,7 @@ class VtxArrayResource(CDataResource):
|
|||
</Array>"""
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
return f"Vtx {self.symbol_name}[{self.cdata_ext.length}]"
|
||||
return f"Vtx {self.symbol_name}[]"
|
||||
|
||||
|
@ -274,10 +275,11 @@ class TextureResource(Resource):
|
|||
self.height_name = f"{self.symbol_name}_HEIGHT"
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if self.is_tlut():
|
||||
raise NotImplementedError
|
||||
return f"{self.elem_type} {self.symbol_name}[{self.height_name}*{self.width_name}*{self.siz.bpp}/8/sizeof({self.elem_type})]"
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") and self.is_tlut():
|
||||
raise NotImplementedError
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
if not self.is_tlut():
|
||||
return f"{self.elem_type} {self.symbol_name}[{self.height_name} * {self.width_name} * {self.siz.bpp} / 8 / sizeof({self.elem_type})]"
|
||||
return f"{self.elem_type} {self.symbol_name}[]"
|
||||
|
||||
def get_c_reference(self, resource_offset: int):
|
||||
|
@ -1335,7 +1337,7 @@ class DListResource(Resource, can_size_be_unknown=True):
|
|||
return RESOURCE_PARSE_SUCCESS
|
||||
|
||||
def get_c_declaration_base(self):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON"):
|
||||
if hasattr(self, "HACK_IS_STATIC_ON") or EXPLICIT_SIZES:
|
||||
length = (self.range_end - self.range_start) // 8
|
||||
return f"Gfx {self.symbol_name}[{length}]"
|
||||
return f"Gfx {self.symbol_name}[]"
|
||||
|
|
Loading…
Reference in New Issue