# roots for the sdk lift (tools/hlbuild/src/sdklift.rs), written for nnSdk 13.3.2, trimmed to what nnSdk 7.3.2 (Luigi's Mansion 3) has: names a main imports. B2's roots for SDK 3.6.0
# (NVN texture-storage functions and the GM200 HAL by address, nn::mem::NumberLineAllocator) are not carried over: B3's main
# imports no NumberLineAllocator; the NVN ones are found by name below (`nvn`, `vmethod`: no addresses in this file).

# libc the game imports from the sdk: pure
div

# hid pure functions (handles computed from the npad id and style)
_ZN2nn3hid23GetSixAxisSensorHandlesEPNS0_19SixAxisSensorHandleEiRKjNS_4util10BitFlagSetILi32ENS0_12NpadStyleTagEEE
_ZN2nn3hid25GetVibrationDeviceHandlesEPNS0_21VibrationDeviceHandleEiRKjNS_4util10BitFlagSetILi32ENS0_12NpadStyleTagEEE

# [witchtime] pure SDK code B3 imports that the runtime has no handler for
_ZN2nn4util30ConvertStringUtf16NativeToUtf8EPciPKti
_ZN2nn4util30ConvertStringUtf8ToUtf16NativeEPtiPKci
_ZN2nn4util43GetLengthOfConvertedStringUtf16NativeToUtf8EPiPKti
_ZN2nn4lmem13CreateExpHeapEPvmi
_ZN2nn4lmem13FreeToExpHeapEPNS0_6detail8HeapHeadEPv
_ZN2nn4lmem19AllocateFromExpHeapEPNS0_6detail8HeapHeadEm

# [witchtime] reached at boot (static constructors, nnMain's input setup): pure SDK code. The Vibration node constructors
# lock the SDK's node list (host SdkMutexType, b3_imports.c); their svc is the contended-lock path (traps if reached).
_ZN2nn3hid14VibrationMixerC1Ev
_ZN2nn3hid14VibrationMixerD1Ev
_ZN2nn3hid15VibrationPlayerC1Ev
_ZN2nn3hid15VibrationPlayerD1Ev
_ZN2nn3hid15VibrationTarget24SetVibrationDeviceHandleERKNS0_21VibrationDeviceHandleE
_ZN2nn3hid15VibrationTargetC1Ev
_ZN2nn3hid15VibrationTargetD1Ev
_ZN2nn3hid15VibrationWriterC1Ev
_ZN2nn3hid15VibrationWriterD1Ev
_ZN2nn3hid23VibrationNodeConnection13SetModulationERKNS0_19VibrationModulationE
_ZN2nn3hid23VibrationNodeConnectionC1Ev
_ZN2nn3hid23VibrationNodeConnectionD1Ev
_ZN2nn7friends12UserPresence5ClearEv
_ZN2nn2os21SdkRecursiveMutexType10InitializeEv

# [witchtime] NVN texture storage rules (runtime/nvn_sdk.c), by name from the sdk's proc table (tools/hlbuild/src/nvn_procs.rs, `hlbuild nvn-procs`), and the
# GPU memory-kind chooser they end in: NvRmGpuDeviceChooseKind -> NvRmNvgpuDevice +0x30 (the HAL object) -> the GM200 HAL's
# kind method +0x90 and the methods it calls (Witch Time's docs/RE_NOTES.md section 6).
nvn nvnTextureBuilderGetStorageSize
nvn nvnTextureBuilderGetStorageAlignment
nvn nvnTextureBuilderGetStorageClass
nvn nvnTextureBuilderGetRawStorageClass
nvn nvnTextureBuilderGetSparseTileLayout
nvn nvnTextureGetStorageClass
nvn nvnTextureGetRawStorageClass
nvn nvnTextureGetSparseTileLayout
nvn nvnTextureGetStorageSize
nvn nvnTextureGetViewOffset
# nnSdk 7.3.2: NvRmGpuDeviceChooseKind -> NvRmNvgpuDevice +0x30 (returns this +0x130, the HAL object) -> the GM200 HAL's
# kind method +0x58, which calls +0x68, +0xe8, +0x100, +0x118, +0x120; those tail-call +0xf0, +0xf8, +0x108, +0x110
vmethod N8nvrm_gpu5nvgpu15NvRmNvgpuDeviceE 30 NvRmNvgpuDevice_get_hal
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 58 HalGM200_choose_kind
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 68 HalGM200_vt_68
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE e8 HalGM200_vt_e8
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE f0 HalGM200_vt_f0
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE f8 HalGM200_vt_f8
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 100 HalGM200_vt_100
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 108 HalGM200_vt_108
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 110 HalGM200_vt_110
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 118 HalGM200_vt_118
vmethod N8nvrm_gpu33NvRmGpu_HwHalFunctions_GM200_BaseE 120 HalGM200_vt_120

# [witchtime] the SDK's own lock (it needs the kernel's thread handles and ArbitrateLock) goes to the runtime's handler
# even when main does not import it: program 1 (the picture book) does not, and its lifted hid code locks one early
cut _ZN2nn2os12SdkMutexType4LockEv
cut _ZN2nn2os12SdkMutexType6UnlockEv

# [witchtime] libc++ that program 1 (the picture book) imports from the sdk (Bayonetta 3 has its own copy): pure code
_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEmmPKcm
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6appendEPKc
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6assignEPKc
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7replaceEmmPKc
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEaSERKS5_
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEC1ERKS5_mmRKS4_
_ZNSt3__16__sortIRNS_6__lessIjjEEPjEEvT0_S5_T_

# Luigi's Mansion 3: pure SDK code main imports and the runtime has no handler for (vibration nodes and players,
# error variants, string conversion and formatting, deflate, crypto, nn::image, web page arguments)
_ZN2nn3err18ErrorResultVariantC1ERKNS0_9ErrorCodeE
_ZN2nn3err18ErrorResultVariantC1ERKNS_6ResultE
_ZN2nn3err18ErrorResultVariantC1Ev
_ZN2nn3err18ErrorResultVariantaSERKNS0_9ErrorCodeE
_ZN2nn3err18ErrorResultVariantaSERKNS_6ResultE
_ZN2nn3err9ShowErrorERKNS0_18ErrorResultVariantE
_ZN2nn3hid13VibrationNode6UpdateEv
_ZN2nn3hid14VibrationMixer10SetMixModeENS0_16VibrationMixModeE
_ZN2nn3hid15VibrationPlayer18SetCurrentPositionEi
_ZN2nn3hid15VibrationPlayer4LoadEPKvm
_ZN2nn3hid15VibrationPlayer4PlayEv
_ZN2nn3hid15VibrationPlayer4StopEv
_ZN2nn3hid15VibrationPlayer6UnloadEv
_ZN2nn3hid15VibrationPlayer7SetLoopEb
_ZN2nn3hid15VibrationTarget26UnsetVibrationDeviceHandleEv
_ZN2nn3hid23VibrationNodeConnection10DisconnectEv
_ZN2nn3hid23VibrationNodeConnection7ConnectEPNS0_13VibrationNodeES3_
_ZN2nn3ldn15MakeIpv4AddressEhhhh
_ZN2nn3web19ShowOfflineHtmlPageEPNS0_26OfflineHtmlPageReturnValueERKNS0_22ShowOfflineHtmlPageArgE
_ZN2nn3web22ShowOfflineHtmlPageArg16SetFooterEnabledEb
_ZN2nn3web22ShowOfflineHtmlPageArg17SetKeyRepeatFrameEii
_ZN2nn3web22ShowOfflineHtmlPageArg17SetPointerEnabledEb
_ZN2nn3web22ShowOfflineHtmlPageArg18SetBootDisplayKindENS0_22OfflineBootDisplayKindE
_ZN2nn3web22ShowOfflineHtmlPageArg18SetPageFadeEnabledEb
_ZN2nn3web22ShowOfflineHtmlPageArg18SetWebAudioEnabledEb
_ZN2nn3web22ShowOfflineHtmlPageArg21SetJsExtensionEnabledEb
_ZN2nn3web22ShowOfflineHtmlPageArg25SetTouchEnabledOnContentsEb
_ZN2nn3web22ShowOfflineHtmlPageArgC1EPKc
_ZN2nn3web26OfflineHtmlPageReturnValueC1Ev
_ZN2nn4util11ReferSymbolEPKv
_ZN2nn4util15CompressDeflateEPmPvmPKvmS2_m
_ZN2nn4util17DecompressDeflateEPvmPKvmS1_m
_ZN2nn4util30ConvertStringUtf16NativeToUtf8EPciPKt
_ZN2nn4util30ConvertStringUtf8ToUtf16NativeEPtiPKc
_ZN2nn4util8SNPrintfEPcmPKcz
_ZN2nn4util9VSNPrintfEPcmPKcSt9__va_list
_ZN2nn5image11ExifBuilder11SetDateTimeEPKcm
_ZN2nn5image11ExifBuilder11SetSoftwareEPKcm
_ZN2nn5image11ExifBuilder12SetMakerNoteEPKvm
_ZN2nn5image11ExifBuilder14SetOrientationENS0_15ExifOrientationE
_ZN2nn5image11ExifBuilder17GetWorkBufferSizeEv
_ZN2nn5image11ExifBuilder7AnalyzeEv
_ZN2nn5image11ExifBuilderC1EPvm
_ZN2nn5image11ExifBuilderD1Ev
_ZN2nn5image11JpegDecoder12SetImageDataEPKvm
_ZN2nn5image11JpegDecoder14SetPixelFormatENS0_11PixelFormatE
_ZN2nn5image11JpegDecoder6DecodeEPvmiS2_m
_ZN2nn5image11JpegDecoder7AnalyzeEv
_ZN2nn5image11JpegDecoderC1Ev
_ZN2nn5image11JpegDecoderD1Ev
_ZN2nn5image11JpegEncoder10SetQualityEi
_ZN2nn5image11JpegEncoder12SetPixelDataEPKvNS0_11PixelFormatERKNS0_9DimensionEi
_ZN2nn5image11JpegEncoder16SetSamplingRatioENS0_17JpegSamplingRatioE
_ZN2nn5image11JpegEncoder6EncodeEPmPvmS3_mPNS0_11ExifBuilderE
_ZN2nn5image11JpegEncoder7AnalyzeEv
_ZN2nn5image11JpegEncoderC1Ev
_ZN2nn5image11JpegEncoderD1Ev
_ZN2nn6crypto16GenerateSha1HashEPvmPKvm
_ZN2nn6crypto36GenerateCryptographicallyRandomBytesEPvm
_ZN2nn6crypto6detail7Md5Impl10InitializeEv
_ZN2nn6crypto6detail7Md5Impl6UpdateEPKvm
_ZN2nn6crypto6detail7Md5Impl7GetHashEPvm
_ZN2nn6crypto6detail7Md5ImplD1Ev
_ZN2nn8settingseqERKNS0_8LanguageERKNS0_12LanguageCodeE
_ZNK2nn3err18ErrorResultVariant8GetStateEv
_ZNK2nn3err18ErrorResultVariantcvNS0_9ErrorCodeEEv
_ZNK2nn3err18ErrorResultVariantcvNS_6ResultEEv
_ZNK2nn3hid13VibrationNode13IsConnectedToEPKS1_
_ZNK2nn3hid15VibrationPlayer11GetFileInfoEv
_ZNK2nn3hid15VibrationPlayer18GetCurrentPositionEv
_ZNK2nn3hid15VibrationPlayer18GetLoopEndPositionEv
_ZNK2nn3hid15VibrationPlayer20GetLoopStartPositionEv
_ZNK2nn3hid15VibrationPlayer6IsLoopEv
_ZNK2nn3hid15VibrationPlayer8IsLoadedEv
_ZNK2nn3hid15VibrationPlayer9IsPlayingEv
_ZNK2nn3hid15VibrationTarget26IsVibrationDeviceHandleSetEv
_ZNK2nn3hid18SixAxisSensorState13GetQuaternionEPNS_4util4neon12Vector4fTypeE
_ZNK2nn5image11JpegDecoder20GetAnalyzedDimensionEv
_ZNK2nn5image11JpegEncoder25GetAnalyzedWorkBufferSizeEv
_ZNKSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7compareEPKc
_ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE7reserveEm

# the vibration nodes call each other through their vtables (VibrationNode::Update -> OnNextSampleRequired)
vtable _ZTVN2nn3hid13VibrationNodeE
vtable _ZTVN2nn3hid14VibrationMixerE
vtable _ZTVN2nn3hid15VibrationPlayerE
vtable _ZTVN2nn3hid15VibrationTargetE
vtable _ZTVN2nn3hid15VibrationWriterE
vtable _ZTVN2nn3hid23VibrationNodeConnectionE

# the vibration nodes end in requests to the hid service: the runtime's handlers (nnhid.c) answer them
cut _ZN2nn3hid18SendVibrationValueERKNS0_21VibrationDeviceHandleERKNS0_14VibrationValueE
cut _ZN2nn3hid23GetActualVibrationValueEPNS0_14VibrationValueERKNS0_21VibrationDeviceHandleE
# nnSdk 7.3.2's VibrationTarget queues its values (detail::EnqueueVibrationValue) and VibrationNode::Update flushes the
# queue to the hid service: the queue call goes to the runtime's SendVibrationValue, the flush does nothing (lm3_imports.c)
cut _ZN2nn3hid6detail21EnqueueVibrationValueERKNS0_21VibrationDeviceHandleERKNS0_14VibrationValueE
cut _ZN2nn3hid6detail28FlushEnqueuedVibrationValuesEv
