# SDK function replaced by hle_<HleName>. Format: "<SdkName> [HleName]" (HleName defaults to SdkName) or "@<hex address> <HleName>".
# Only implemented HLE functions belong here (a missing one is a link error).
# Names come from identified_sdk.txt (Dolphin database, unverified: tech-debt TD-007) and symbols.txt (manual, with evidence).

# --- OS threads, synchronisation, interrupts, time, alarms (runtime/hle/os_*.cpp)
OSCreateThread
OSResumeThread
OSSuspendThread
OSSleepThread
OSWakeupThread
OSYieldThread
OSExitThread
OSJoinThread
OSSetThreadPriority
OSCancelThread
@802613A4 OSDisableScheduler
@802613E0 OSEnableScheduler
OSInitMutex
OSLockMutex
OSUnlockMutex
OSInitMessageQueue
OSSendMessage
OSReceiveMessage
OSJamMessage
OSDisableInterrupts
OSEnableInterrupts
OSRestoreInterrupts
OSGetTime
__OSGetSystemTime OSGetTime
OSGetTick
OSSetAlarm
OSSetPeriodicAlarm
OSCancelAlarm
OSReport
OSPanic

# --- DVD (runtime/hle/dvd.cpp)
DVDInit
DVDConvertPathToEntrynum
DVDFastOpen
DVDOpen
DVDReadPrio
DVDReadAsyncPrio
DVDClose
DVDCancel
DVDCancelAsync

# --- Video interface (runtime/hle/vi.cpp)
__VIInit VIInit
VIConfigure
VIFlush
VISetNextFrameBuffer
VISetBlack
VIGetTvFormat
VIWaitForRetrace

# --- CPU cache maintenance (runtime/hle/nop.cpp): a native build has no cache to flush/invalidate/enable, so these have no observable effect.
# DCZeroRange and LC data/queue wrappers run translated; block transfers copy real memory natively.
@8025A668 LCLoadBlocks
@8025A68C LCStoreBlocks
DCEnable Nop
DCInvalidateRange Nop
DCFlushRange Nop
DCStoreRange Nop
DCFlushRangeNoSync Nop
DCStoreRangeNoSync Nop
ICInvalidateRange Nop
ICFlashInvalidate Nop
ICEnable Nop
LCEnable Nop
LCDisable Nop

# --- EXI bus, no devices attached (runtime/hle/exi.cpp, tech-debt TD-010)
EXIImm
EXIDma
EXIImmEx
EXISync
EXISelect
EXIDeselect
EXILock
EXIUnlock
EXIGetID
EXIAttach
EXIDetach
__EXIProbe EXIProbe

# --- DSP boot (tech-debt TD-011): __OSInitAudioSystem resets the DSP and polls its mailbox for the boot handshake; AI clock setup inside is irrelevant natively.
__OSInitAudioSystem Nop
DSPAddTask          # runtime/hle/dsp.cpp: accepts the task and reports its boot; never runs it
DSPInit Nop         # starts the DSP and its task manager; waits for the DSP mailbox handshake
@8027319C AIStartDMA
@80274DD0 AXFrame
__AI_SRC_INIT Nop   # AI sample-rate calibration: spins on the AI sample counter against the timebase

# --- MMU / memory protection setup (BAT registers, MI protection windows): the native build has one flat address space, so nothing to configure.
__OSInitMemoryProtection Nop

# --- IOS call interface (runtime/hle/ios.cpp, tech-debt TD-012)
IOS_Open
IOS_OpenAsync
IOS_Close
IOS_CloseAsync
IOS_Read
IOS_ReadAsync
IOS_Write
IOS_WriteAsync
IOS_Seek
IOS_SeekAsync
IOS_Ioctl
IOS_IoctlAsync
IOS_Ioctlv
IOS_IoctlvAsync

# Native host save files; verified RBUE08 ISFS ABI (runtime/hle/save.cpp).
@802AC778 NANDInit
@802A7534 ISFS_OpenLib
@802A77C4 ISFS_CreateDir
@802A78B8 ISFS_CreateDirAsync
@802A83BC ISFS_CreateFile
@802A84B0 ISFS_CreateFileAsync
@802A85A4 ISFS_Open
@802A866C ISFS_OpenAsync
@802A873C ISFS_GetFileStats
@802A8758 ISFS_Seek
@802A875C ISFS_SeekAsync
@802A87E8 ISFS_Read
@802A8808 ISFS_ReadAsync
@802A88AC ISFS_Write
@802A88CC ISFS_WriteAsync
@802A8970 ISFS_Close
@802A8974 ISFS_CloseAsync
@802A79AC ISFS_ReadDir
@802A7B00 ISFS_ReadDirAsync
@802A7C48 ISFS_GetAttr
@802A7DA0 ISFS_GetAttrAsync
@802A7ED4 ISFS_Delete
@802A7FAC ISFS_DeleteAsync
@802A807C ISFS_Rename
@802A8180 ISFS_RenameAsync
@802A8284 ISFS_GetUsage

# --- CPU synchronisation call (`sc; blr`): nothing to order on a native build.
PPCSync Nop

# --- Verified GX boundaries (docs/spikes/G0-gx-audit.md): native vertices and real GPU completion.
GXBegin
GXSetArray
GXSetDrawDone
GXWaitDrawDone
GXDrawDone
GXBeginDisplayList
GXEndDisplayList
GXCallDisplayList
GXSetProjection
GXSetProjectionv
GXLoadPosMtxImm
GXLoadPosMtxIndx
GXSetCurrentMtx
@80288BFC GXSetMatrixIndex
@803740B8 ResResetMatrixIndices
@80374114 ResTexMatrixIndices
GXSetCopyClear
GXCopyDisp
@80285334 GXSetTexCopySrc
@80285398 GXSetTexCopyDst
@80285974 GXCopyTex
GXLoadTexObjPreLoaded
GXLoadTlut
@80366E78 ResTevApply
@80366FF4 ResPixelApply
@80367024 ResColorApply
@80366D3C ResMeshSetup
@80366E14 ResMeshDraw
@80376148 ResChannelApply
@80373D00 ResGenerationMode
GXLoadLightObjImm
GXLoadNrmMtxImm
@80288900 GXLoadNrmMtxIndx3x3
@80286190 GXSetNumChans
@802861B4 GXSetChanCtrl
@80287B80 GXSetAlphaCompare
@80287908 GXSetTevColor
@80287968 GXSetTevColorS10
@802879CC GXSetTevKColor
@80288954 GXLoadTexMtxImm
@80287650 GXSetTevDirect
@802872A4 GXSetTevIndirect
@8028730C GXSetIndTexMtx
@80287460 GXSetIndTexCoordScale
@80287564 GXSetIndTexOrder
@80287DC4 GXSetFog

# RBUE08 startup logo update; original body continues at80245860 (game/intro.cpp).
@8024585C IntroLogoUpdate
@801426D4 MovieUpdate
# Native ultrawide: C_MTXPerspective with a wider aspect on a wider output; the original body continues at 80265468 (game/intro.cpp).
@80265464 MTXPerspective
@801581E0 GameFrameWait
@8003F670 GameLoop
@800C790C ActorStepTime
@800329FC FixedPlaybackStep
@8014D368 HudNameDelay
@80210278 PropStep
@801172A4 PhysicsStep
@80117464 PhysicsHit
@800F1D08 PhysicsAutoDisable
@800EA9B0 PhysicsBodyDestroy
@801C4438 FlightStep
@801C44B8 FlightPathStep
@801C56F0 FlightPhaseStep
@801B0AAC CameraHistoryStep
@801A5130 DeferredActorStep
@80136EEC RumbleStep
@80162A68 TrailHistoryStep
@80123D14 JumpBlendStep
@80165610 CrossfadeStep
@80044D14 WorldRaycast

# --- Wii Remote library (tech-debt TD-013): KPADInit starts the WPAD/Bluetooth stack (HCI over IOS) and waits for the controller radio.
KPADInit Nop
KPADRead
@802E159C WPADProbe
@80288274 GXSetBlendMode
@802882C4 GXSetColorUpdate
@802882F0 GXSetAlphaUpdate
KPADEnableMotor Nop
# The game's rumble (WPADControlMotor, called by the rumble step and the home menu): the host plays it on the pads and the Wii Remote (runtime/native_input.cpp).
WPADControlMotor

# Native action binding getter; exact scoped Grenade recognition belongs to host actions.
@8003FB98 GameActionMask
@8006C268 GameWeaponUpdate
@801AB350 GameActionOwnerUpdate
@80171D38 GameMotionCount

# --- Dolphin SDK matrix/vector library (mtx.a, runtime/hle/sdk_math.cpp): bit-exact native versions of the translated paired-single code.
# Mapped by address because identified_sdk.txt lists other, unrelated functions under the same names.
@80264680 ModelHistoryIdentity
# In-place game 4x4 transpose, including both resume entries.
@80137F78 MatrixTranspose4
@80137F9C MatrixTranspose4Resume
@801380B4 MatrixTranspose4Return
@80394A10 MatrixEulerFinish
@802646AC PSMTXCopy
@802646E0 PSMTXConcat
@80264DE0 PSMTXTransApply
@80264E54 PSMTXScaleApply
@802652E8 PSMTXMultVec
@802656EC PSVECAdd
@80265710 PSVECSubtract
@80265734 PSVECScale
@80265750 PSVECNormalize
@80265794 PSVECSquareMag
@802657AC PSVECMag
@802657F0 PSQUATDotProduct
@80265810 PSVECCrossProduct
@801316C8 BoundsRecordInit   # 10-store init of a bounds record, called ~66 times per hit buffer
@800462E8 HitBufferConstruct   # constructor of the collision hit buffer (32+1 bounds records)
@80046394 HitBufferDestruct   # destructor of the collision hit buffer (33 empty element destructors: dead frames and polls only)
@80137BC4 Leaf_80137BC4   # tools/leaf_hle.py: generated native leaf functions (4x4 matrix product, vec4 helpers, ...)
@80139368 Leaf_80139368
@801394B8 Leaf_801394B8
@8013951C Leaf_8013951C
@8013939C Leaf_8013939C
@801393C0 Leaf_801393C0
@80139448 Leaf_80139448
@803947A4 Leaf_803947A4
@80394B04 Leaf_80394B04
@80138AF8 Leaf_80138AF8
@80394CE4 Leaf_80394CE4
@80032FD8 Leaf_80032FD8
@80139610 Leaf_80139610
@800521A0 Leaf_800521A0
@800AFCD8 Leaf_800AFCD8
@80394374 SinCosFIdx
@8003EDD0 Leaf_8003EDD0
@80367314 Leaf_80367314
@80365C7C Leaf_80365C7C
@802655E8 Leaf_802655E8
@80394FAC Leaf_80394FAC
@803B4F68 Leaf_803B4F68
@8037B388 Leaf_8037B388
@8029C4AC Leaf_8029C4AC
@80367660 Leaf_80367660
@8005669C Leaf_8005669C
@80078A00 Leaf_80078A00
@800FFD14 Leaf_800FFD14
@80138B1C Leaf_80138B1C
@80235294 Leaf_80235294
@802647AC Leaf_802647AC
@80273674 Leaf_80273674
@80365C28 Leaf_80365C28
@80374210 Leaf_80374210
@80394BC8 Leaf_80394BC8
@80064C34 VectorAddStep
@802447D8 UiPhysicsStep
@80211734 TimelineStep
@8006DB34 WeaponTrailStep
@801B916C EffectRetireStep
@8012AEE8 TargetRefreshStep
@803AA7B0 SoundFrameStep
@8004C91C SoundRetryStep
@80049000 SoundWaitStep
@803C1BF8 HomeMenuStep
@80394914 Leaf_80394914
@803948C0 Leaf_803948C0
@803942AC Leaf_803942AC
@803890C8 Leaf_803890C8
@803703F8 Leaf_803703F8
@8013969C Leaf_8013969C
@80139648 Leaf_80139648
@80032D70 Leaf_80032D70
@80032FF4 Leaf_80032FF4
@8011F1E4 Leaf_8011F1E4
@8036624C Leaf_8036624C
@8036B2C8 Leaf_8036B2C8
@8003F468 Leaf_8003F468
@801996BC Leaf_801996BC
@80394548 Leaf_80394548
@800ABCE0 Leaf_800ABCE0
@800460A0 SegmentTriangleHit   # the game's segment/triangle collision test built on the vector routines above

# --- Register save/restore helpers of the compiler (runtime/hle/sdk_regs.cpp): _savefpr_N, _restfpr_N, _savegpr_N, _restgpr_N for N = 14..31; the entry for register N is the base + 4 * (N - 14)
@80289D28 SaveFpr14
@80289D2C SaveFpr15
@80289D30 SaveFpr16
@80289D34 SaveFpr17
@80289D38 SaveFpr18
@80289D3C SaveFpr19
@80289D40 SaveFpr20
@80289D44 SaveFpr21
@80289D48 SaveFpr22
@80289D4C SaveFpr23
@80289D50 SaveFpr24
@80289D54 SaveFpr25
@80289D58 SaveFpr26
@80289D5C SaveFpr27
@80289D60 SaveFpr28
@80289D64 SaveFpr29
@80289D68 SaveFpr30
@80289D6C SaveFpr31
@80289D74 RestFpr14
@80289D78 RestFpr15
@80289D7C RestFpr16
@80289D80 RestFpr17
@80289D84 RestFpr18
@80289D88 RestFpr19
@80289D8C RestFpr20
@80289D90 RestFpr21
@80289D94 RestFpr22
@80289D98 RestFpr23
@80289D9C RestFpr24
@80289DA0 RestFpr25
@80289DA4 RestFpr26
@80289DA8 RestFpr27
@80289DAC RestFpr28
@80289DB0 RestFpr29
@80289DB4 RestFpr30
@80289DB8 RestFpr31
@80289DC0 SaveGpr14
@80289DC4 SaveGpr15
@80289DC8 SaveGpr16
@80289DCC SaveGpr17
@80289DD0 SaveGpr18
@80289DD4 SaveGpr19
@80289DD8 SaveGpr20
@80289DDC SaveGpr21
@80289DE0 SaveGpr22
@80289DE4 SaveGpr23
@80289DE8 SaveGpr24
@80289DEC SaveGpr25
@80289DF0 SaveGpr26
@80289DF4 SaveGpr27
@80289DF8 SaveGpr28
@80289DFC SaveGpr29
@80289E00 SaveGpr30
@80289E04 SaveGpr31
@80289E0C RestGpr14
@80289E10 RestGpr15
@80289E14 RestGpr16
@80289E18 RestGpr17
@80289E1C RestGpr18
@80289E20 RestGpr19
@80289E24 RestGpr20
@80289E28 RestGpr21
@80289E2C RestGpr22
@80289E30 RestGpr23
@80289E34 RestGpr24
@80289E38 RestGpr25
@80289E3C RestGpr26
@80289E40 RestGpr27
@80289E44 RestGpr28
@80289E48 RestGpr29
@80289E4C RestGpr30
@80289E50 RestGpr31
