From e0949bba6b22595f3dd10696a3daf4eafd5f7a31 Mon Sep 17 00:00:00 2001 From: MasaGratoR Date: Tue, 23 Mar 2021 15:06:52 +0100 Subject: [PATCH] Fix linkage for C++ projects (#79) --- source/aes.h | 8 ++++++++ source/bfttf.h | 8 ++++++++ source/bktr.h | 8 ++++++++ source/cert.h | 8 ++++++++ source/cnmt.h | 8 ++++++++ source/crc32_fast.h | 8 ++++++++ source/es.h | 8 ++++++++ source/fs_ext.h | 8 ++++++++ source/gamecard.h | 8 ++++++++ source/hfs.h | 8 ++++++++ source/keys.h | 8 ++++++++ source/legal_info.h | 8 ++++++++ source/log.h | 8 ++++++++ source/mem.h | 8 ++++++++ source/nacp.h | 8 ++++++++ source/nca.h | 8 ++++++++ source/npdm.h | 8 ++++++++ source/nso.h | 8 ++++++++ source/pfs.h | 8 ++++++++ source/program_info.h | 8 ++++++++ source/romfs.h | 8 ++++++++ source/rsa.h | 8 ++++++++ source/save.h | 8 ++++++++ source/services.h | 8 ++++++++ source/tik.h | 8 ++++++++ source/title.h | 8 ++++++++ source/ums.h | 8 ++++++++ source/usb.h | 8 ++++++++ source/utils.h | 10 +++++++++- 29 files changed, 233 insertions(+), 1 deletion(-) diff --git a/source/aes.h b/source/aes.h index 85f630c..880aa20 100644 --- a/source/aes.h +++ b/source/aes.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __AES_H__ #define __AES_H__ @@ -81,3 +85,7 @@ NX_INLINE void aes128CtrUpdatePartialCtrEx(u8 *ctr, u32 ctr_val, u64 offset) } #endif /* __AES_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/bfttf.h b/source/bfttf.h index 6bd6daf..f574afe 100644 --- a/source/bfttf.h +++ b/source/bfttf.h @@ -21,6 +21,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __BFTTF_H__ #define __BFTTF_H__ @@ -53,3 +57,7 @@ void bfttfExit(void); bool bfttfGetFontByType(BfttfFontData *font, u8 font_type); #endif /* __BFTTF_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/bktr.h b/source/bktr.h index 97a8a6b..83ec386 100644 --- a/source/bktr.h +++ b/source/bktr.h @@ -21,6 +21,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __BKTR_H__ #define __BKTR_H__ @@ -154,3 +158,7 @@ NX_INLINE bool bktrGeneratePathFromFileEntry(BktrContext *ctx, RomFileSystemFile } #endif /* __BKTR_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/cert.h b/source/cert.h index bdc20e1..e2f2e71 100644 --- a/source/cert.h +++ b/source/cert.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __CERT_H__ #define __CERT_H__ @@ -241,3 +245,7 @@ NX_INLINE u64 certGetSignedCertificateHashAreaSize(void *buf) } #endif /* __CERT_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/cnmt.h b/source/cnmt.h index afdde0e..e5b2116 100644 --- a/source/cnmt.h +++ b/source/cnmt.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __CNMT_H__ #define __CNMT_H__ @@ -290,3 +294,7 @@ NX_INLINE u32 cnmtGetRequiredTitleVersion(ContentMetaContext *cnmt_ctx) } #endif /* __CNMT_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/crc32_fast.h b/source/crc32_fast.h index 5de5844..1b4b7f2 100644 --- a/source/crc32_fast.h +++ b/source/crc32_fast.h @@ -23,6 +23,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __CRC32_FAST_H__ #define __CRC32_FAST_H__ @@ -31,3 +35,7 @@ void crc32FastCalculate(const void *data, u64 n_bytes, u32 *crc); #endif /* __CRC32_FAST_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/es.h b/source/es.h index 72e0259..677b564 100644 --- a/source/es.h +++ b/source/es.h @@ -21,6 +21,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __ES_H__ #define __ES_H__ @@ -33,3 +37,7 @@ Result esListCommonTicket(s32 *out_entries_written, FsRightsId *out_ids, s32 cou Result esListPersonalizedTicket(s32 *out_entries_written, FsRightsId *out_ids, s32 count); #endif /* __ES_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/fs_ext.h b/source/fs_ext.h index fe74186..631941a 100644 --- a/source/fs_ext.h +++ b/source/fs_ext.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __FS_EXT_H__ #define __FS_EXT_H__ @@ -46,3 +50,7 @@ Result fsDeviceOperatorUpdatePartitionInfo(FsDeviceOperator *d, const FsGameCard Result fsDeviceOperatorGetGameCardDeviceCertificate(FsDeviceOperator *d, const FsGameCardHandle *handle, FsGameCardCertificate *out); #endif /* __FS_EXT_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/gamecard.h b/source/gamecard.h index cab2ec1..18ce29d 100644 --- a/source/gamecard.h +++ b/source/gamecard.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __GAMECARD_H__ #define __GAMECARD_H__ @@ -235,3 +239,7 @@ bool gamecardGetHashFileSystemContext(u8 hfs_partition_type, HashFileSystemConte bool gamecardGetHashFileSystemEntryInfoByName(u8 hfs_partition_type, const char *entry_name, u64 *out_offset, u64 *out_size); #endif /* __GAMECARD_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/hfs.h b/source/hfs.h index 75ffaa6..1a11192 100644 --- a/source/hfs.h +++ b/source/hfs.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __HFS_H__ #define __HFS_H__ @@ -118,3 +122,7 @@ NX_INLINE HashFileSystemEntry *hfsGetEntryByName(HashFileSystemContext *ctx, con } #endif /* __HFS_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/keys.h b/source/keys.h index ddc99a2..d68092c 100644 --- a/source/keys.h +++ b/source/keys.h @@ -22,6 +22,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __KEYS_H__ #define __KEYS_H__ @@ -34,3 +38,7 @@ const u8 *keysGetTitlekek(u8 key_generation); const u8 *keysGetKeyAreaEncryptionKey(u8 key_generation, u8 kaek_index); #endif /* __KEYS_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/legal_info.h b/source/legal_info.h index 5c0a10b..d5d29ce 100644 --- a/source/legal_info.h +++ b/source/legal_info.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __LEGAL_INFO_H__ #define __LEGAL_INFO_H__ @@ -44,3 +48,7 @@ NX_INLINE void legalInfoFreeContext(LegalInfoContext *legal_info_ctx) } #endif /* __LEGAL_INFO_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/log.h b/source/log.h index f38fe2a..9884842 100644 --- a/source/log.h +++ b/source/log.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __LOG_H__ #define __LOG_H__ @@ -55,3 +59,7 @@ void logGetLastMessage(char *dst, size_t dst_size); void logControlMutex(bool lock); #endif /* __LOG_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/mem.h b/source/mem.h index 95edf0c..f512df3 100644 --- a/source/mem.h +++ b/source/mem.h @@ -21,6 +21,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __MEM_H__ #define __MEM_H__ @@ -56,3 +60,7 @@ NX_INLINE void memFreeMemoryLocation(MemoryLocation *location) } #endif /* __MEM_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/nacp.h b/source/nacp.h index d7d824f..1e3edb3 100644 --- a/source/nacp.h +++ b/source/nacp.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __NACP_H__ #define __NACP_H__ @@ -452,3 +456,7 @@ NX_INLINE bool nacpIsValidContext(NacpContext *nacp_ctx) } #endif /* __NACP_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/nca.h b/source/nca.h index b47fa94..f62de90 100644 --- a/source/nca.h +++ b/source/nca.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __NCA_H__ #define __NCA_H__ @@ -494,3 +498,7 @@ NX_INLINE void ncaFreeHierarchicalIntegrityPatch(NcaHierarchicalIntegrityPatch * } #endif /* __NCA_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/npdm.h b/source/npdm.h index 048a7cc..1eb440e 100644 --- a/source/npdm.h +++ b/source/npdm.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __NPDM_H__ #define __NPDM_H__ @@ -589,3 +593,7 @@ NX_INLINE u32 npdmGetKernelCapabilityDescriptorEntryValue(NpdmKernelCapabilityDe } #endif /* __NPDM_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/nso.h b/source/nso.h index b83d76c..8708add 100644 --- a/source/nso.h +++ b/source/nso.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __NSO_H__ #define __NSO_H__ @@ -142,3 +146,7 @@ NX_INLINE void nsoFreeContext(NsoContext *nso_ctx) } #endif /* __NSO_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/pfs.h b/source/pfs.h index 66cb90f..c8acb8c 100644 --- a/source/pfs.h +++ b/source/pfs.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PFS_H__ #define __PFS_H__ @@ -187,3 +191,7 @@ NX_INLINE char *pfsGetEntryNameByIndexFromFileContext(PartitionFileSystemFileCon } #endif /* __PFS_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/program_info.h b/source/program_info.h index 31cec1c..9d64c78 100644 --- a/source/program_info.h +++ b/source/program_info.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __PROGRAM_INFO_H__ #define __PROGRAM_INFO_H__ @@ -81,3 +85,7 @@ NX_INLINE void programInfoWriteNcaPatch(ProgramInfoContext *program_info_ctx, vo } #endif /* __PROGRAM_INFO_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/romfs.h b/source/romfs.h index cdf18f6..5d16540 100644 --- a/source/romfs.h +++ b/source/romfs.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __ROMFS_H__ #define __ROMFS_H__ @@ -200,3 +204,7 @@ NX_INLINE void romfsFreeFileEntryPatch(RomFileSystemFileEntryPatch *patch) } #endif /* __ROMFS_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/rsa.h b/source/rsa.h index c3a0ec3..4017754 100644 --- a/source/rsa.h +++ b/source/rsa.h @@ -22,6 +22,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __RSA_H__ #define __RSA_H__ @@ -41,3 +45,7 @@ const u8 *rsa2048GetCustomPublicKey(void); bool rsa2048OaepDecryptAndVerify(void *dst, size_t dst_size, const void *signature, const void *modulus, const void *exponent, size_t exponent_size, const void *label_hash, size_t *out_size); #endif /* __RSA_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/save.h b/source/save.h index d43bed4..c921bd6 100644 --- a/source/save.h +++ b/source/save.h @@ -21,6 +21,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __SAVE_H__ #define __SAVE_H__ @@ -514,3 +518,7 @@ void save_close_savefile(save_ctx_t *ctx); bool save_get_fat_storage_from_file_entry_by_path(save_ctx_t *ctx, const char *path, allocation_table_storage_ctx_t *out_fat_storage, u64 *out_file_entry_size); #endif /* __SAVE_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/services.h b/source/services.h index 4c5d146..281406e 100644 --- a/source/services.h +++ b/source/services.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __SERVICES_H__ #define __SERVICES_H__ @@ -50,3 +54,7 @@ void servicesChangeHardwareClockRates(u32 cpu_rate, u32 mem_rate); Result servicesHasService(bool *out, const char *name); #endif /* __SERVICES_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/tik.h b/source/tik.h index 019cf76..d211991 100644 --- a/source/tik.h +++ b/source/tik.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __TIK_H__ #define __TIK_H__ @@ -225,3 +229,7 @@ NX_INLINE bool tikIsPersonalizedTicket(Ticket *tik) } #endif /* __TIK_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/title.h b/source/title.h index 6970c01..5952517 100644 --- a/source/title.h +++ b/source/title.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __TITLE_H__ #define __TITLE_H__ @@ -265,3 +269,7 @@ NX_INLINE u32 titleGetCountFromInfoBlock(TitleInfo *title_info) } #endif /* __TITLE_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/ums.h b/source/ums.h index 6d11a9b..aae933f 100644 --- a/source/ums.h +++ b/source/ums.h @@ -20,6 +20,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __UMS_H__ #define __UMS_H__ @@ -39,3 +43,7 @@ bool umsIsDeviceInfoUpdated(void); UsbHsFsDevice *umsGetDevices(u32 *out_count); #endif /* __UMS_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/usb.h b/source/usb.h index 6332993..05d3957 100644 --- a/source/usb.h +++ b/source/usb.h @@ -23,6 +23,10 @@ #pragma once +#ifdef __cplusplus +extern "C" { +#endif + #ifndef __USB_H__ #define __USB_H__ @@ -70,3 +74,7 @@ NX_INLINE bool usbSendFilePropertiesCommon(u64 file_size, const char *filename) } #endif /* __USB_H__ */ + +#ifdef __cplusplus +} +#endif \ No newline at end of file diff --git a/source/utils.h b/source/utils.h index be40524..1c9d63c 100644 --- a/source/utils.h +++ b/source/utils.h @@ -25,6 +25,10 @@ #include "common.h" +#ifdef __cplusplus +extern "C" { +#endif + #define APP_BASE_PATH "sdmc:/switch/" APP_TITLE "/" #define MEMBER_SIZE(type, member) sizeof(((type*)NULL)->member) @@ -137,4 +141,8 @@ NX_INLINE void utilsSleep(u64 seconds) if (seconds) svcSleepThread(seconds * (u64)1000000000); } -#endif /* __UTILS_H__ */ +#ifdef __cplusplus +} +#endif + +#endif /* __UTILS_H__ */ \ No newline at end of file