Nacptool: fix bug with title id parsing on Windows. (#19)

* Fix bug with title id parsing on Windows.

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.

* Use SCNx64 instead.
This commit is contained in:
thedax 2018-10-08 12:10:55 -04:00 committed by yellows8
parent 16fcc678e2
commit 3c91ce8d6b

View File

@ -2,6 +2,7 @@
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <inttypes.h>
typedef uint64_t u64;
typedef uint32_t u32;
@ -79,7 +80,7 @@ int main(int argc, char* argv[]) {
int argi;
u64 titleid=0;
for (argi=6; argi<argc; argi++) {
if (strncmp(argv[argi], "--titleid=", 10)==0) sscanf(&argv[argi][10], "%016lX", &titleid);
if (strncmp(argv[argi], "--titleid=", 10)==0) sscanf(&argv[argi][10], "%016" SCNx64, &titleid);
}
for (i=0; i<12; i++) {//These are UTF-8.