-
Notifications
You must be signed in to change notification settings - Fork 33
Nacptool: fix bug with title id parsing on Windows. #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
Conversation
On Windows, longs (as specified by %lX) are 32-bit, not 64-bit, so assuming its size results in the upper 32-bits of the title id being lost.
|
Instead of hardcoding the format specifier, inttypes.h should be included and SCNX64 should be used instead. |
|
Sure, one sec. |
|
SCNx64 != SCNX64 btw. |
|
That doesn't seem to exist, hence why I used SCNx64.
Windows and Linux both complain: It's also not in Windows's version of inttypes.h (admittedly, I only checked VS2017 here, I do not have mingw or cygwin set up), nor Antergos Linux's. Did I miss something here? |
|
I see. Somehow I had googled one version of this file and it did have |
|
Is using PRIX64 an option since SCNX64 isn't available? |
|
It's technically invalid to use PRI codes for scanf. |
|
Is there a proper way to keep using uppercase-hex?(Wouldn't changing to lowercase break input which uses uppercase?) |
I just checked and at least on macOS the |
|
(Using "x" is fine if it's still compat with uppercase on all platforms) |
On Windows, longs (as specified by %lX) are 32-bit, not 64-bit, so assuming its size results in the upper 32-bits of the title id being lost.
Appears to still work fine on Linux (tested on Antergos) and macOS.
gcc(this output is from clang, but it should also output with -Wall on gcc) also warns about this:Shoutout to @jakibaki for testing on macOS.