diff --git a/Makefile b/Makefile index c311818..ef472e0 100644 --- a/Makefile +++ b/Makefile @@ -2,11 +2,17 @@ include config.mk ifeq ($(OS),Windows_NT) LDFLAGS += -liconv +else +UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Darwin) + CFLAGS += -I/usr/local/opt/libgcrypt/include + LDFLAGS += -L/usr/local/opt/libgcrypt/lib + endif endif .PHONY: clean -CFLAGS += -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=2 -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 +CFLAGS += -D_BSD_SOURCE -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L -D_DEFAULT_SOURCE -D__USE_MINGW_ANSI_STDIO=1 -D_FILE_OFFSET_BITS=64 all: ncatool diff --git a/filepath.h b/filepath.h index a4df4d5..efa5948 100644 --- a/filepath.h +++ b/filepath.h @@ -42,4 +42,4 @@ oschar_t *filepath_get(filepath_t *fpath); -#endif \ No newline at end of file +#endif diff --git a/nca.h b/nca.h index 9798daf..9fb35a5 100644 --- a/nca.h +++ b/nca.h @@ -202,4 +202,4 @@ void nca_save_pfs0_section(nca_section_ctx_t *ctx); void nca_save_ivfc_section(nca_section_ctx_t *ctx); void nca_save_bktr_section(nca_section_ctx_t *ctx); -#endif \ No newline at end of file +#endif diff --git a/npdm.c b/npdm.c index 06898e2..b615e7b 100644 --- a/npdm.c +++ b/npdm.c @@ -370,17 +370,17 @@ void kac_print(uint32_t *descriptors, uint32_t num_descriptors) { } if (kac.has_kern_flags) { - printf(" Lowest Allowed Priority: %"PRId8"\n", kac.lowest_thread_prio); - printf(" Highest Allowed Priority: %"PRId8"\n", kac.highest_thread_prio); - printf(" Lowest Allowed CPU ID: %"PRId8"\n", kac.lowest_cpu_id); - printf(" Highest Allowed CPU ID: %"PRId8"\n", kac.highest_cpu_id); + printf(" Lowest Allowed Priority: %"PRId32"\n", kac.lowest_thread_prio); + printf(" Highest Allowed Priority: %"PRId32"\n", kac.highest_thread_prio); + printf(" Lowest Allowed CPU ID: %"PRId32"\n", kac.lowest_cpu_id); + printf(" Highest Allowed CPU ID: %"PRId32"\n", kac.highest_cpu_id); } int first_svc = 1; for (unsigned int i = 0; i < 0x80; i++) { if (kac.svcs_allowed[i]) { - printf(first_svc ? " Allowed SVCs: %-35s (0x%02"PRIx8")\n" : " %-35s (0x%02"PRIx8")\n", svc_names[i], i); + printf(first_svc ? " Allowed SVCs: %-35s (0x%02"PRIx32")\n" : " %-35s (0x%02"PRIx32")\n", svc_names[i], i); first_svc = 0; } } @@ -567,10 +567,10 @@ void sac_print(char *acid_sac, uint32_t acid_size, char *aci0_sac, uint32_t aci0 void fac_print(fac_t *fac, fah_t *fah) { if (fac->version == fah->version) { - printf(" Version: %"PRId8"\n", fac->version); + printf(" Version: %"PRId32"\n", fac->version); } else { - printf(" Control Version: %"PRId8"\n", fac->version); - printf(" Header Version: %"PRId8"\n", fah->version); + printf(" Control Version: %"PRId32"\n", fac->version); + printf(" Header Version: %"PRId32"\n", fah->version); } uint64_t perms = fac->perms & fah->perms; printf(" Raw Permissions: 0x%016"PRIx64"\n", perms); diff --git a/npdm.h b/npdm.h index 3aaf9e1..d9a4d14 100644 --- a/npdm.h +++ b/npdm.h @@ -134,4 +134,4 @@ static inline npdm_aci0_t *npdm_get_aci0(npdm_t *npdm) { void npdm_print(npdm_t *npdm, ncatool_ctx_t *tool_ctx); -#endif \ No newline at end of file +#endif diff --git a/pfs0.h b/pfs0.h index 3b22600..19d43f0 100644 --- a/pfs0.h +++ b/pfs0.h @@ -38,4 +38,4 @@ static inline char *pfs0_get_file_name(pfs0_header_t *hdr, uint32_t i) { return pfs0_get_string_table(hdr) + pfs0_get_file_entry(hdr, i)->string_table_offset; } -#endif \ No newline at end of file +#endif diff --git a/pki.h b/pki.h index 2e4db6f..182c1e9 100644 --- a/pki.h +++ b/pki.h @@ -241,4 +241,4 @@ static inline void pki_initialize_keyset(nca_keyset_t *keyset, keyset_variant_t } } -#endif \ No newline at end of file +#endif diff --git a/rsa.h b/rsa.h index e0f3683..d7b79e1 100644 --- a/rsa.h +++ b/rsa.h @@ -6,4 +6,4 @@ int rsa2048_pss_verify(const void *data, size_t len, const unsigned char *signature, const unsigned char *modulus); -#endif \ No newline at end of file +#endif diff --git a/settings.h b/settings.h index b628f7d..dec1605 100644 --- a/settings.h +++ b/settings.h @@ -56,4 +56,4 @@ typedef struct { } ncatool_ctx_t; -#endif \ No newline at end of file +#endif diff --git a/sha.h b/sha.h index ed6839b..8aaa0d3 100644 --- a/sha.h +++ b/sha.h @@ -18,4 +18,4 @@ void sha_free(sha_ctx_t *ctx); void sha_hash_buffer(unsigned char *hash, const void *data, size_t l); -#endif \ No newline at end of file +#endif