-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bfont format #220
base: main
Are you sure you want to change the base?
bfont format #220
Conversation
- 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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
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. |
"height" / Int32ul, | ||
"unk1" / Int32ul, | ||
"unk2" / Int32ul, | ||
"glyph_count" / Rebuild(Int32ul, lambda ctx: len(ctx.glyph_data)), |
There was a problem hiding this comment.
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]) |
There was a problem hiding this comment.
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), |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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))), |
There was a problem hiding this comment.
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......
maps characters onto the sprite atlas textures