Skip to content
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

decomp3: more engine files, get-texture macro, use print method in autogenerated inspect, fix bitfield float print #3432

Merged
merged 13 commits into from Mar 23, 2024

Conversation

Hat-Kid
Copy link
Member

@Hat-Kid Hat-Kid commented Mar 21, 2024

  • fma-sphere
  • prim-beam-h
  • cam-start
  • ragdoll
  • light-trails-h
  • light-trails
  • menu
  • water
  • water-flow
  • hud
  • hud-classes
  • progress
  • progress-draw

The get-texture macro replaces calls to lookup-texture-by-id and lookup-texture-by-id-fast. The defpart macro detection was modified to print a pair like (texture-name tpage-name) for the texture field that gets turned into a texture-id constant. Only used in Jak 3 at the moment, I'll probably go through the other games at a later point.

str_template += fmt::format("{}{}: #<{} @ #x~X>~%", tabs, f.name(), f.type().print());
auto ts = m_ts.lookup_type_no_throw(f.type());
if (ts) {
// try to use print method if the structure implements it
Copy link
Collaborator

Choose a reason for hiding this comment

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

This probably needs more testing, but I think you could always use the print method case ({}{}: ~{}P~%). That should work on everything. If you don't define a custom print method, I think it will fall back on a default one.

Copy link
Member Author

Choose a reason for hiding this comment

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

This is what I tried at first, but this makes structures without a print method default to structure's print, which would always print #<structure @ #x~X> instead of #<actual-type-name @ #x~X>.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, good point.

I guess you'd need to check to see if the print method of the type is different from the print method of structure, and only use the actual print method if it is... maybe not worth the effort. Just seeing the vectors in inspect will be a huge improvement.

@water111 water111 merged commit 99866ce into open-goal:master Mar 23, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants