-
Notifications
You must be signed in to change notification settings - Fork 49
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
s32 typedef should be long instead of int in PPC code #238
Comments
I think the issue here is more complicated than the built-in typedefs. My understanding is that However, the Instead, the reason Unfortunately, I think making That being said, it might be possible to work around this specifically for function definitions? We could try to use the "raw" (Separately, it would be straightforward to add a flag to always emit |
That makes sense. It would be a mess to keep track of types everywhere. But I think in the case of function prototypes for a decompiled function, it should copy exactly the types that the user specified in the context instead of rewriting it. I know it's able to do this with enums already and not have them decay to a generic s32. |
The Gamecube/Wii headers typedef s32 as long, whereas m2c's default typedefs assume that s32 is int. https://github.com/matt-kempster/m2c/blob/master/src/c_types.py#L554
This ends up changing function parameters in the context from int to s32 and from unsigned int to u32. For example, if a function being decompiled is declared
void myfunc(int arg0);
in the context, it will get changed tovoid myfunc(s32 arg0)
in the decompiler output.One solution to this problem would be to only add these default typedefs if they are not present in the scratch, which will allow the user to override them.
The text was updated successfully, but these errors were encountered: