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

Decompiling TWatergun #49

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

TheAzack9
Copy link

This is still WIP, just marking progress

NozzleData mNozzles[6];
};
// Define the global variable in .data section
const static TNozzleBmdData nozzleBmdData = {
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is probably wrong, because with a static variable in a header this symbol will appear in every single TU that the header is included into. Instead it probably should be extern const TNozzleBmdData nozzleBmdData; (the declaration) in the header and a regular non-static definition in the .cpp file with the initializer

Copy link
Author

Choose a reason for hiding this comment

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

TIL! I will fix👍

{1, 0},
{4, 0},
{4, 0}
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

JFYI: before merging you'll have to format, and to make clang-format not uglify large initializers like this one what you need to do is to leave an oxford comma after the last element in each subobject

if (p1 != nullptr) {
*(float *)((int)&this->mEmitPos[0].x + offset) = (p1)[0][3];
*(float *)((int)&this->mEmitPos[0].y + offset) = (p1)[1][3];
*(float *)((int)&this->mEmitPos[0].z + offset) = (p1)[2][3];
Copy link
Collaborator

Choose a reason for hiding this comment

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

This doesn't look like something they would've written. I think it should be

mEmitPos[index].x = p1[0][3];
mEmitPos[index].y = p1[1][3];
mEmitPos[index].z = p1[2][3];

which might also fix the regswap

Copy link
Author

Choose a reason for hiding this comment

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

I don't disagree that this is 99% wrong, but it is the closest i could get. Doing it like suggested was further off than a register diff. Not sure exactly why, but i'm suspecting that this is some kind of inline setter as well. I will add a comment about it!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it's better to leave it matching less but making more sense. I've seen analogous problems in a couple of other places, so once we have enough examples, it should be easier to figure out the real inline (which is probably inside of TVec). But I'm not insisting, it's okay to leave as-is too =)

@TheAzack9 TheAzack9 force-pushed the watergun branch 2 times, most recently from f91ef46 to e014016 Compare March 2, 2025 09:43
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