From 51b17f35fe94485a119042d7e72c9a6f8633e4f4 Mon Sep 17 00:00:00 2001 From: Pablo Curiel Date: Mon, 10 Jul 2023 18:06:34 +0200 Subject: [PATCH] Use BITL macro from libnx. --- include/core/nacp.h | 2 +- include/core/npdm.h | 82 +++++++++++++++++++++--------------------- include/defines.h | 2 -- source/core/gamecard.c | 12 +++---- 4 files changed, 48 insertions(+), 50 deletions(-) diff --git a/include/core/nacp.h b/include/core/nacp.h index 2d60ea7..c4f26bc 100644 --- a/include/core/nacp.h +++ b/include/core/nacp.h @@ -282,7 +282,7 @@ typedef enum { } NacpRequiredNetworkServiceLicenseOnLaunch; typedef enum { - NacpJitConfigurationFlag_Enabled = BIT_LONG(0), + NacpJitConfigurationFlag_Enabled = BITL(0), NacpJitConfigurationFlag_Count = 1 ///< Total values supported by this enum. } NacpJitConfigurationFlag; diff --git a/include/core/npdm.h b/include/core/npdm.h index 8b5ef45..980c233 100644 --- a/include/core/npdm.h +++ b/include/core/npdm.h @@ -153,47 +153,47 @@ typedef struct { NXDT_ASSERT(NpdmAciHeader, 0x40); typedef enum { - NpdmFsAccessControlFlags_ApplicationInfo = BIT_LONG(0), - NpdmFsAccessControlFlags_BootModeControl = BIT_LONG(1), - NpdmFsAccessControlFlags_Calibration = BIT_LONG(2), - NpdmFsAccessControlFlags_SystemSaveData = BIT_LONG(3), - NpdmFsAccessControlFlags_GameCard = BIT_LONG(4), - NpdmFsAccessControlFlags_SaveDataBackUp = BIT_LONG(5), - NpdmFsAccessControlFlags_SaveDataManagement = BIT_LONG(6), - NpdmFsAccessControlFlags_BisAllRaw = BIT_LONG(7), - NpdmFsAccessControlFlags_GameCardRaw = BIT_LONG(8), - NpdmFsAccessControlFlags_GameCardPrivate = BIT_LONG(9), - NpdmFsAccessControlFlags_SetTime = BIT_LONG(10), - NpdmFsAccessControlFlags_ContentManager = BIT_LONG(11), - NpdmFsAccessControlFlags_ImageManager = BIT_LONG(12), - NpdmFsAccessControlFlags_CreateSaveData = BIT_LONG(13), - NpdmFsAccessControlFlags_SystemSaveDataManagement = BIT_LONG(14), - NpdmFsAccessControlFlags_BisFileSystem = BIT_LONG(15), - NpdmFsAccessControlFlags_SystemUpdate = BIT_LONG(16), - NpdmFsAccessControlFlags_SaveDataMeta = BIT_LONG(17), - NpdmFsAccessControlFlags_DeviceSaveData = BIT_LONG(18), - NpdmFsAccessControlFlags_SettingsControl = BIT_LONG(19), - NpdmFsAccessControlFlags_SystemData = BIT_LONG(20), - NpdmFsAccessControlFlags_SdCard = BIT_LONG(21), - NpdmFsAccessControlFlags_Host = BIT_LONG(22), - NpdmFsAccessControlFlags_FillBis = BIT_LONG(23), - NpdmFsAccessControlFlags_CorruptSaveData = BIT_LONG(24), - NpdmFsAccessControlFlags_SaveDataForDebug = BIT_LONG(25), - NpdmFsAccessControlFlags_FormatSdCard = BIT_LONG(26), - NpdmFsAccessControlFlags_GetRightsId = BIT_LONG(27), - NpdmFsAccessControlFlags_RegisterExternalKey = BIT_LONG(28), - NpdmFsAccessControlFlags_RegisterUpdatePartition = BIT_LONG(29), - NpdmFsAccessControlFlags_SaveDataTransfer = BIT_LONG(30), - NpdmFsAccessControlFlags_DeviceDetection = BIT_LONG(31), - NpdmFsAccessControlFlags_AccessFailureResolution = BIT_LONG(32), - NpdmFsAccessControlFlags_SaveDataTransferVersion2 = BIT_LONG(33), - NpdmFsAccessControlFlags_RegisterProgramIndexMapInfo = BIT_LONG(34), - NpdmFsAccessControlFlags_CreateOwnSaveData = BIT_LONG(35), - NpdmFsAccessControlFlags_MoveCacheStorage = BIT_LONG(36), - NpdmFsAccessControlFlags_DeviceTreeBlob = BIT_LONG(37), - NpdmFsAccessControlFlags_NotifyErrorContextServiceReady = BIT_LONG(38), - NpdmFsAccessControlFlags_Debug = BIT_LONG(62), - NpdmFsAccessControlFlags_FullPermission = BIT_LONG(63) + NpdmFsAccessControlFlags_ApplicationInfo = BITL(0), + NpdmFsAccessControlFlags_BootModeControl = BITL(1), + NpdmFsAccessControlFlags_Calibration = BITL(2), + NpdmFsAccessControlFlags_SystemSaveData = BITL(3), + NpdmFsAccessControlFlags_GameCard = BITL(4), + NpdmFsAccessControlFlags_SaveDataBackUp = BITL(5), + NpdmFsAccessControlFlags_SaveDataManagement = BITL(6), + NpdmFsAccessControlFlags_BisAllRaw = BITL(7), + NpdmFsAccessControlFlags_GameCardRaw = BITL(8), + NpdmFsAccessControlFlags_GameCardPrivate = BITL(9), + NpdmFsAccessControlFlags_SetTime = BITL(10), + NpdmFsAccessControlFlags_ContentManager = BITL(11), + NpdmFsAccessControlFlags_ImageManager = BITL(12), + NpdmFsAccessControlFlags_CreateSaveData = BITL(13), + NpdmFsAccessControlFlags_SystemSaveDataManagement = BITL(14), + NpdmFsAccessControlFlags_BisFileSystem = BITL(15), + NpdmFsAccessControlFlags_SystemUpdate = BITL(16), + NpdmFsAccessControlFlags_SaveDataMeta = BITL(17), + NpdmFsAccessControlFlags_DeviceSaveData = BITL(18), + NpdmFsAccessControlFlags_SettingsControl = BITL(19), + NpdmFsAccessControlFlags_SystemData = BITL(20), + NpdmFsAccessControlFlags_SdCard = BITL(21), + NpdmFsAccessControlFlags_Host = BITL(22), + NpdmFsAccessControlFlags_FillBis = BITL(23), + NpdmFsAccessControlFlags_CorruptSaveData = BITL(24), + NpdmFsAccessControlFlags_SaveDataForDebug = BITL(25), + NpdmFsAccessControlFlags_FormatSdCard = BITL(26), + NpdmFsAccessControlFlags_GetRightsId = BITL(27), + NpdmFsAccessControlFlags_RegisterExternalKey = BITL(28), + NpdmFsAccessControlFlags_RegisterUpdatePartition = BITL(29), + NpdmFsAccessControlFlags_SaveDataTransfer = BITL(30), + NpdmFsAccessControlFlags_DeviceDetection = BITL(31), + NpdmFsAccessControlFlags_AccessFailureResolution = BITL(32), + NpdmFsAccessControlFlags_SaveDataTransferVersion2 = BITL(33), + NpdmFsAccessControlFlags_RegisterProgramIndexMapInfo = BITL(34), + NpdmFsAccessControlFlags_CreateOwnSaveData = BITL(35), + NpdmFsAccessControlFlags_MoveCacheStorage = BITL(36), + NpdmFsAccessControlFlags_DeviceTreeBlob = BITL(37), + NpdmFsAccessControlFlags_NotifyErrorContextServiceReady = BITL(38), + NpdmFsAccessControlFlags_Debug = BITL(62), + NpdmFsAccessControlFlags_FullPermission = BITL(63) } NpdmFsAccessControlFlags; /// FsAccessControl descriptor. Part of the ACID section body. diff --git a/include/defines.h b/include/defines.h index a48fb99..7e55022 100644 --- a/include/defines.h +++ b/include/defines.h @@ -30,8 +30,6 @@ #define MAX_ELEMENTS(x) ((sizeof((x))) / (sizeof((x)[0]))) -#define BIT_LONG(n) (1UL << (n)) - #define ALIGN_UP(x, y) (((x) + ((y) - 1)) & ~((y) - 1)) #define ALIGN_DOWN(x, y) ((x) & ~((y) - 1)) #define IS_ALIGNED(x, y) (((x) & ((y) - 1)) == 0) diff --git a/source/core/gamecard.c b/source/core/gamecard.c index bca5fc9..abe1766 100644 --- a/source/core/gamecard.c +++ b/source/core/gamecard.c @@ -46,12 +46,12 @@ typedef enum { } GameCardStorageArea; typedef enum { - GameCardCapacity_1GiB = BIT_LONG(30), - GameCardCapacity_2GiB = BIT_LONG(31), - GameCardCapacity_4GiB = BIT_LONG(32), - GameCardCapacity_8GiB = BIT_LONG(33), - GameCardCapacity_16GiB = BIT_LONG(34), - GameCardCapacity_32GiB = BIT_LONG(35) + GameCardCapacity_1GiB = BITL(30), + GameCardCapacity_2GiB = BITL(31), + GameCardCapacity_4GiB = BITL(32), + GameCardCapacity_8GiB = BITL(33), + GameCardCapacity_16GiB = BITL(34), + GameCardCapacity_32GiB = BITL(35) } GameCardCapacity; /* Global variables. */