Skip to content

Conversation

steven11sjf
Copy link
Contributor

maps characters onto the sprite atlas textures

- matches the sprite alias to the buct file?
- two unks that i couldn't track down
- i think the <region>_32.bfont are the only ones used. others have
  different dimensions to their atlases.
Copy link

codecov bot commented Sep 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.36%. Comparing base (16d3e10) to head (039fc10).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #220      +/-   ##
==========================================
+ Coverage   76.24%   76.36%   +0.12%     
==========================================
  Files          76       77       +1     
  Lines        3528     3546      +18     
==========================================
+ Hits         2690     2708      +18     
  Misses        838      838              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

"height" / Int32ul,
"unk1" / Int32ul,
"unk2" / Int32ul,
"glyph_count" / Rebuild(Int32ul, lambda ctx: len(ctx.glyph_data)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

construct.len_(construct.this.glyph_data) instead of the lambda

return math.ceil(offset / pad_to) * pad_to


Sprite = Struct("pos" / Int16sl[2], "width" / Int16sl, "height" / Int16sl, "unk1" / Int16sl, "unk2" / Int16sl[2])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a , after the last argument so it ends up multi-line

"_data_start" / Rebuild(Int32ul, lambda ctx: calc_padding(0x10, 0x28 + len(ctx.atlas_path))),
"_buct_name_offset" / Rebuild(Int32ul, lambda ctx: calc_padding(0x4, ctx._data_start + ctx.glyph_count * 14)),
"atlas_path" / StrId,
AlignTo(0x10),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does just adding construct.Aligned work here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think so. Aligned adds bytes until the subcon length is a multiple of the modulus, while this should be aligned to the file.

"unk1" / Int32ul,
"unk2" / Int32ul,
"glyph_count" / Rebuild(Int32ul, lambda ctx: len(ctx.glyph_data)),
"_data_start" / Rebuild(Int32ul, lambda ctx: calc_padding(0x10, 0x28 + len(ctx.atlas_path))),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's gotta be a way to have this be calculated automatically somehow......

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants