-
Notifications
You must be signed in to change notification settings - Fork 19
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
base: main
Are you sure you want to change the base?
Conversation
include/Player/WaterGun.hpp
Outdated
NozzleData mNozzles[6]; | ||
}; | ||
// Define the global variable in .data section | ||
const static TNozzleBmdData nozzleBmdData = { |
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.
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
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.
TIL! I will fix👍
include/Player/WaterGun.hpp
Outdated
{1, 0}, | ||
{4, 0}, | ||
{4, 0} | ||
} |
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.
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
include/Player/WaterGun.hpp
Outdated
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]; |
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.
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
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 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!
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 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 =)
f91ef46
to
e014016
Compare
This is still WIP, just marking progress