mirror of
https://github.com/SciresM/hactool
synced 2024-11-26 05:50:24 +00:00
Fix compiling on macOS by adding the Homebrew library includes, fix clang compilation warnings (missing newlines, fixed some printf arguments, updated old POSIX standard causing clang not to define vsnprintf)
This commit is contained in:
parent
9e5c20c465
commit
6a4b94bec3
10 changed files with 23 additions and 17 deletions
8
Makefile
8
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
|
||||
|
||||
|
|
|
@ -42,4 +42,4 @@ oschar_t *filepath_get(filepath_t *fpath);
|
|||
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
2
nca.h
2
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
|
||||
#endif
|
||||
|
|
16
npdm.c
16
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);
|
||||
|
|
2
npdm.h
2
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
|
||||
#endif
|
||||
|
|
2
pfs0.h
2
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
|
||||
#endif
|
||||
|
|
2
pki.h
2
pki.h
|
@ -241,4 +241,4 @@ static inline void pki_initialize_keyset(nca_keyset_t *keyset, keyset_variant_t
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
2
rsa.h
2
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
|
||||
#endif
|
||||
|
|
|
@ -56,4 +56,4 @@ typedef struct {
|
|||
} ncatool_ctx_t;
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
2
sha.h
2
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
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue