mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-30 18:55:54 +00:00
refactor CDataExt.set_write callback args to use a dataclass
This commit is contained in:
parent
8e5e543731
commit
6e9b4d1a59
12 changed files with 215 additions and 202 deletions
|
@ -15,6 +15,7 @@ from ..extase.cdata_resources import (
|
|||
CDataExt_Struct,
|
||||
CDataExt_Value,
|
||||
CDataExt_Array,
|
||||
CDataExtWriteContext,
|
||||
)
|
||||
|
||||
from . import dlist_resources
|
||||
|
@ -117,12 +118,12 @@ class CurveAnimationHeaderResource(CDataResource):
|
|||
)
|
||||
|
||||
def write_knotCounts(
|
||||
resource, memory_context: "MemoryContext", v, f: io.TextIOBase, line_prefix
|
||||
resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext
|
||||
):
|
||||
assert isinstance(v, int)
|
||||
address = v
|
||||
f.write(line_prefix)
|
||||
f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
wctx.f.write(wctx.line_prefix)
|
||||
wctx.f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
return True
|
||||
|
||||
def report_interpolationData(resource, memory_context: "MemoryContext", v):
|
||||
|
@ -138,12 +139,12 @@ class CurveAnimationHeaderResource(CDataResource):
|
|||
)
|
||||
|
||||
def write_interpolationData(
|
||||
resource, memory_context: "MemoryContext", v, f: io.TextIOBase, line_prefix
|
||||
resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext
|
||||
):
|
||||
assert isinstance(v, int)
|
||||
address = v
|
||||
f.write(line_prefix)
|
||||
f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
wctx.f.write(wctx.line_prefix)
|
||||
wctx.f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
return True
|
||||
|
||||
def report_constantData(resource, memory_context: "MemoryContext", v):
|
||||
|
@ -159,12 +160,12 @@ class CurveAnimationHeaderResource(CDataResource):
|
|||
)
|
||||
|
||||
def write_constantData(
|
||||
resource, memory_context: "MemoryContext", v, f: io.TextIOBase, line_prefix
|
||||
resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext
|
||||
):
|
||||
assert isinstance(v, int)
|
||||
address = v
|
||||
f.write(line_prefix)
|
||||
f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
wctx.f.write(wctx.line_prefix)
|
||||
wctx.f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
return True
|
||||
|
||||
cdata_ext = CDataExt_Struct(
|
||||
|
@ -283,12 +284,12 @@ class SkelCurveLimbArrayResource(CDataResource):
|
|||
)
|
||||
|
||||
def write_limb_element(
|
||||
resource, memory_context: "MemoryContext", v, f: io.TextIOBase, line_prefix
|
||||
resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext
|
||||
):
|
||||
assert isinstance(v, int)
|
||||
address = v
|
||||
f.write(line_prefix)
|
||||
f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
wctx.f.write(wctx.line_prefix)
|
||||
wctx.f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
return True
|
||||
|
||||
elem_cdata_ext = (
|
||||
|
@ -328,12 +329,12 @@ class CurveSkeletonHeaderResource(CDataResource):
|
|||
)
|
||||
|
||||
def write_limbs(
|
||||
resource, memory_context: "MemoryContext", v, f: io.TextIOBase, line_prefix
|
||||
resource, memory_context: "MemoryContext", v, wctx: CDataExtWriteContext
|
||||
):
|
||||
assert isinstance(v, int)
|
||||
address = v
|
||||
f.write(line_prefix)
|
||||
f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
wctx.f.write(wctx.line_prefix)
|
||||
wctx.f.write(memory_context.get_c_reference_at_segmented(address))
|
||||
return True
|
||||
|
||||
cdata_ext = CDataExt_Struct(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue