@@ -107,7 +107,6 @@ class GfxMatWriteMethod(enum.Enum):
107107 "OOT" : oot_default_draw_layers ,
108108}
109109
110-
111110def normalize_hex_pointer (name : str ) -> str :
112111 stripped = name .strip ()
113112 if stripped .lower ().startswith ("0x" ):
@@ -131,7 +130,6 @@ def format_asset_path(objectPath: str | None, name: str | None) -> str:
131130 return sanitized_name
132131 return sanitized_path
133132
134-
135133CCMUXDict = {
136134 "COMBINED" : 0 ,
137135 "TEXEL0" : 1 ,
@@ -2163,7 +2161,7 @@ def to_binary(self):
21632161 )
21642162
21652163 def to_soh_xml (self ):
2166- baseStr = ' <Vtx X="{pX}" Y="{pY}" Z="{pZ}" S="{s}" T="{t}" R="{r}" G="{g}" B="{b}" A="{a}"/>'
2164+ baseStr = " <Vtx X=\ " {pX}\ " Y=\ " {pY}\ " Z=\ " {pZ}\ " S=\ " {s}\ " T=\ " {t}\ " R=\ " {r}\ " G=\ " {g}\ " B=\ " {b}\ " A=\ " {a}\ " />"
21672165 return baseStr .format (
21682166 pX = self .position [0 ],
21692167 pY = self .position [1 ],
@@ -2264,7 +2262,7 @@ def to_binary(self):
22642262 return data
22652263
22662264 def to_soh_xml (self ):
2267- data = ' <Vertex Version="0 ">\n '
2265+ data = " <Vertex Version=\" 0 \ " >\n "
22682266 for vert in self .vertices :
22692267 data += "\t " + vert .to_soh_xml () + "\n "
22702268 data += "</Vertex>\n "
@@ -2363,7 +2361,7 @@ def to_c(self, f3d, name_override: Optional[str] = None):
23632361 return data
23642362
23652363 def to_soh_xml (self , modelDirPath , objectPath ):
2366- data = ' <DisplayList Version="0 ">\n '
2364+ data = " <DisplayList Version=\" 0 \ " >\n "
23672365 for command in self .commands :
23682366 if isinstance (command , (SPDisplayList , SPBranchList , SPVertex , DPSetTextureImage )):
23692367 data += "\t " + command .to_soh_xml (objectPath ) + "\n "
@@ -2382,15 +2380,13 @@ def toO2R(self, folderPath: str, segments: dict | None = None):
23822380 data .extend (struct .pack ("<I" , 1 ))
23832381 data .extend (struct .pack (">IIQIQIQQQI" , 0x4F444C54 , 0 , 0xDEADBEEFDEADBEEF , 0 , 0 , 0 , 0 , 0 , 0 , 0 ))
23842382
2385- data .extend (
2386- struct .pack (
2387- ">bBHI" ,
2388- 4 ,
2389- 0xFF ,
2390- 0xFFFF ,
2391- 0xFFFFFFFF ,
2392- )
2393- )
2383+ data .extend (struct .pack (
2384+ ">bBHI" ,
2385+ 4 ,
2386+ 0xFF ,
2387+ 0xFFFF ,
2388+ 0xFFFFFFFF ,
2389+ ))
23942390
23952391 data .extend (struct .pack (">II" , 0x33 << 24 , 0xBEEFBEEF ))
23962392
@@ -2898,7 +2894,7 @@ def to_soh_xml(self, modelDirPath, objectPath, include_cull_vertices=True, combi
28982894
28992895 if combined_call_lines or combined_other_lines :
29002896 data += (
2901- ' <DisplayList Version="0 ">\n '
2897+ " <DisplayList Version=\" 0 \ " >\n "
29022898 + "" .join (combined_call_lines + combined_other_lines )
29032899 + "</DisplayList>\n \n "
29042900 )
@@ -3444,7 +3440,7 @@ def to_soh_xml(self, modelDirPath, objectPath, include_cull_vertices=True, write
34443440 return ""
34453441
34463442 call_lines , other_lines = self .get_soh_root_draw_lines (objectPath )
3447- drawData = ' <DisplayList Version="0 ">\n ' + "" .join (call_lines + other_lines ) + "</DisplayList>\n \n "
3443+ drawData = " <DisplayList Version=\" 0 \ " >\n " + "" .join (call_lines + other_lines ) + "</DisplayList>\n \n "
34483444 writeXMLData (drawData , os .path .join (modelDirPath , self .draw .name ))
34493445 return drawData
34503446
@@ -3540,10 +3536,8 @@ def has_scroll_data(self):
35403536 True if either texture has non-zero scroll values
35413537 """
35423538 return (
3543- self .tile_scroll_tex0 .s != 0
3544- or self .tile_scroll_tex0 .t != 0
3545- or self .tile_scroll_tex1 .s != 0
3546- or self .tile_scroll_tex1 .t != 0
3539+ self .tile_scroll_tex0 .s != 0 or self .tile_scroll_tex0 .t != 0 or
3540+ self .tile_scroll_tex1 .s != 0 or self .tile_scroll_tex1 .t != 0
35473541 )
35483542
35493543 def to_soh_xml (self ):
@@ -3970,7 +3964,9 @@ def textureTypeO2R(self) -> int:
39703964 def toO2R (self , folderPath : str ):
39713965 data = bytearray (0 )
39723966
3973- print (f"FImage.toO2R { self .name } { self .fmt } { self .bitSize } { self .width } x{ self .height } { len (self .data )} bytes" )
3967+ print (
3968+ f"FImage.toO2R { self .name } { self .fmt } { self .bitSize } { self .width } x{ self .height } { len (self .data )} bytes"
3969+ )
39743970
39753971 data .extend (struct .pack ("<IIIQIQIQQQI" , 0 , 0x4F544558 , 0 , 0xDEADBEEFDEADBEEF , 0 , 0 , 0 , 0 , 0 , 0 , 0 ))
39763972 data .extend (struct .pack ("<IIII" , self .textureTypeO2R (), self .width , self .height , len (self .data )))
@@ -4153,7 +4149,6 @@ def to_c(self, static=True):
41534149 header += "segmented_to_virtual(" + self .vertList .name + " + " + str (self .offset ) + ")"
41544150 else :
41554151 header += self .vertList .name + " + " + str (self .offset )
4156-
41574152 return header + ", " + str (self .count ) + ", " + str (self .index ) + ")"
41584153
41594154 def toO2R (self , folderPath : str ):
@@ -4176,7 +4171,7 @@ def toO2R(self, folderPath: str):
41764171 return data
41774172
41784173 def to_soh_xml (self , objectPath = "" ):
4179- baseStr = ' <LoadVertices Path="{parent}/{vertexPath}" VertexBufferIndex="{bufferIndex}" VertexOffset="{vertexOffset}" Count="{count}"/>'
4174+ baseStr = " <LoadVertices Path=\ " {parent}/{vertexPath}\ " VertexBufferIndex=\ " {bufferIndex}\ " VertexOffset=\ " {vertexOffset}\ " Count=\ " {count}\ " />"
41804175 return baseStr .format (
41814176 parent = objectPath ,
41824177 vertexPath = self .vertList .name ,
@@ -5109,7 +5104,6 @@ def to_soh_xml(self, objectPath=""):
51095104 flags = "," .join (sorted (self .flagList ))
51105105 return f'<GeometryFlags Mode="Load" Flags="{ flags } "/>'
51115106
5112-
51135107def gsSPSetOtherMode (cmd , sft , length , data , f3d ):
51145108 if f3d .F3DEX_GBI_2 :
51155109 words = _SHIFTL (cmd , 24 , 8 ) | _SHIFTL (32 - (sft ) - (length ), 8 , 8 ) | _SHIFTL ((length ) - 1 , 0 , 8 ), data
@@ -5458,13 +5452,11 @@ def toO2R(self, folderPath: str):
54585452 return data
54595453
54605454 def to_soh_xml (self , objectPath = "" ):
5461- prefix = (
5462- self .image .internal_path
5463- if self .image .internal_path
5464- else (objectPath if self .image .filename is not None else "" )
5465- )
5455+ prefix = self .image .internal_path if self .image .internal_path else (objectPath if self .image .filename is not None else "" )
54665456 imagePath = format_asset_path (prefix , self .image .name if self .image .name else "" )
5467- return f'<SetTextureImage Path="{ imagePath } " Format="{ self .fmt } " Size="{ self .siz } " Width="{ self .width } "/>'
5457+ return (
5458+ f'<SetTextureImage Path="{ imagePath } " Format="{ self .fmt } " Size="{ self .siz } " Width="{ self .width } "/>'
5459+ )
54685460
54695461
54705462def gsDPSetCombine (muxs0 , muxs1 , f3d ):
@@ -5540,7 +5532,7 @@ def _ac(name: str) -> str:
55405532 return name if name .startswith ("G_ACMUX_" ) else f"G_ACMUX_{ name } "
55415533
55425534 return (
5543- " <SetCombineLERP "
5535+ ' <SetCombineLERP '
55445536 f'A0="{ _cc (self .a0 )} " B0="{ _cc (self .b0 )} " C0="{ _cc (self .c0 )} " D0="{ _cc (self .d0 )} " '
55455537 f'Aa0="{ _ac (self .Aa0 )} " Ab0="{ _ac (self .Ab0 )} " Ac0="{ _ac (self .Ac0 )} " Ad0="{ _ac (self .Ad0 )} " '
55465538 f'A1="{ _cc (self .a1 )} " B1="{ _cc (self .b1 )} " C1="{ _cc (self .c1 )} " D1="{ _cc (self .d1 )} " '
@@ -5590,7 +5582,7 @@ def to_binary(self, f3d, segments):
55905582 def to_soh_xml (self , objectPath = "" ):
55915583 return (
55925584 f'<SetEnvColor R="{ self .r } " G="{ self .g } " B="{ self .b } " A="{ self .a } "'
5593- f" { getDynamicCosmeticXmlAttrs (self .cosmeticEntry , self .cosmeticCategory )} />"
5585+ f' { getDynamicCosmeticXmlAttrs (self .cosmeticEntry , self .cosmeticCategory )} />'
55945586 )
55955587
55965588
@@ -5653,7 +5645,7 @@ def to_binary(self, f3d, segments):
56535645 def to_soh_xml (self , objectPath = "" ):
56545646 return (
56555647 f'<SetPrimColor M="{ self .m } " L="{ self .l } " R="{ self .r } " G="{ self .g } " B="{ self .b } " A="{ self .a } "'
5656- f" { getDynamicCosmeticXmlAttrs (self .cosmeticEntry , self .cosmeticCategory )} />"
5648+ f' { getDynamicCosmeticXmlAttrs (self .cosmeticEntry , self .cosmeticCategory )} />'
56575649 )
56585650
56595651
@@ -5733,7 +5725,10 @@ def is_LOADTILE(self, f3d):
57335725 return self .tile == f3d .G_TX_LOADTILE
57345726
57355727 def to_soh_xml (self , objectPath = "" ):
5736- return f'<SetTileSize T="{ self .tile } " Uls="{ self .uls } " Ult="{ self .ult } " ' f'Lrs="{ self .lrs } " Lrt="{ self .lrt } "/>'
5728+ return (
5729+ f'<SetTileSize T="{ self .tile } " Uls="{ self .uls } " Ult="{ self .ult } " '
5730+ f'Lrs="{ self .lrs } " Lrt="{ self .lrt } "/>'
5731+ )
57375732
57385733
57395734@dataclass (unsafe_hash = True )
@@ -5748,7 +5743,10 @@ def to_binary(self, f3d, segments):
57485743 return gsDPLoadTileGeneric (f3d .G_LOADTILE , self .tile , self .uls , self .ult , self .lrs , self .lrt )
57495744
57505745 def to_soh_xml (self , objectPath = "" ):
5751- return f'<LoadTile Tile="{ self .tile } " Uls="{ self .uls } " Ult="{ self .ult } " ' f'Lrs="{ self .lrs } " Lrt="{ self .lrt } "/>'
5746+ return (
5747+ f'<LoadTile Tile="{ self .tile } " Uls="{ self .uls } " Ult="{ self .ult } " '
5748+ f'Lrs="{ self .lrs } " Lrt="{ self .lrt } "/>'
5749+ )
57525750
57535751
57545752@dataclass (unsafe_hash = True )
@@ -5818,7 +5816,8 @@ def to_binary(self, f3d, segments):
58185816
58195817 def to_soh_xml (self , objectPath = "" ):
58205818 return (
5821- f'<LoadBlock Tile="{ self .tile } " Uls="{ self .uls } " Ult="{ self .ult } " ' f'Lrs="{ self .lrs } " Dxt="{ self .dxt } " />'
5819+ f'<LoadBlock Tile="{ self .tile } " Uls="{ self .uls } " Ult="{ self .ult } " '
5820+ f'Lrs="{ self .lrs } " Dxt="{ self .dxt } " />'
58225821 )
58235822
58245823
@@ -6523,4 +6522,5 @@ def to_soh_xml(self):
65236522 DPLoadTLUT_pal16 ,
65246523 DPLoadTLUT_pal256 ,
65256524 DPLoadTLUT ,
6526- ]
6525+ ]
6526+
0 commit comments