Remove unnecessary importc from inline and fixup some compilation
This commit is contained in:
parent
22c168b67e
commit
2519f4d88d
42 changed files with 164 additions and 246 deletions
|
|
@ -166,8 +166,7 @@ proc errorCodeCreateResult*(res: Result): ErrorCode {.inline, cdecl.} =
|
|||
return errorCodeCreate(2000 + r_Module(res), r_Description(res))
|
||||
|
||||
|
||||
proc errorCodeCreateInvalid*(): ErrorCode {.inline, cdecl,
|
||||
importc: "errorCodeCreateInvalid".} =
|
||||
proc errorCodeCreateInvalid*(): ErrorCode {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Creates an invalid \ref ErrorCode.
|
||||
##
|
||||
|
|
|
|||
|
|
@ -8,21 +8,21 @@
|
|||
import
|
||||
../types
|
||||
|
||||
proc armGetSystemTick*(): U64 {.inline, cdecl, importc: "armGetSystemTick".} =
|
||||
proc armGetSystemTick*(): U64 {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Gets the current system tick.
|
||||
## @return The current system tick.
|
||||
##
|
||||
{.emit: "__asm__ __volatile__ (\"mrs %x[data], cntpct_el0\" : [data] \"=r\" (`result`));".}
|
||||
|
||||
proc armGetSystemTickFreq*(): U64 {.inline, cdecl, importc: "armGetSystemTickFreq".} =
|
||||
proc armGetSystemTickFreq*(): U64 {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Gets the system counter-timer frequency
|
||||
## @return The system counter-timer frequency, in Hz.
|
||||
##
|
||||
{.emit: "__asm__ (\"mrs %x[data], cntfrq_el0\" : [data] \"=r\" (`result`));".}
|
||||
|
||||
proc armNsToTicks*(ns: U64): U64 {.inline, cdecl, importc: "armNsToTicks".} =
|
||||
proc armNsToTicks*(ns: U64): U64 {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Converts from nanoseconds to CPU ticks unit.
|
||||
## @param ns Time in nanoseconds.
|
||||
|
|
@ -30,7 +30,7 @@ proc armNsToTicks*(ns: U64): U64 {.inline, cdecl, importc: "armNsToTicks".} =
|
|||
##
|
||||
{.emit: "return (`ns` * 12) / 625;".}
|
||||
|
||||
proc armTicksToNs*(tick: U64): U64 {.inline, cdecl, importc: "armTicksToNs".} =
|
||||
proc armTicksToNs*(tick: U64): U64 {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Converts from CPU ticks unit to nanoseconds.
|
||||
## @param tick Time in ticks.
|
||||
|
|
|
|||
|
|
@ -110,8 +110,7 @@ type
|
|||
esr*: U32
|
||||
far*: U32
|
||||
|
||||
proc threadContextIsAArch64*(ctx: ptr ThreadContext): bool {.inline, cdecl,
|
||||
importc: "threadContextIsAArch64".} =
|
||||
proc threadContextIsAArch64*(ctx: ptr ThreadContext): bool {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Determines whether a thread context belong to an AArch64 process based on the PSR.
|
||||
## @param[in] ctx Thread context to which PSTATE/cspr has been dumped to.
|
||||
|
|
@ -120,8 +119,7 @@ proc threadContextIsAArch64*(ctx: ptr ThreadContext): bool {.inline, cdecl,
|
|||
|
||||
return (ctx.psr and 0x10) == 0
|
||||
|
||||
proc threadExceptionIsAArch64*(ctx: ptr ThreadExceptionDump): bool {.inline, cdecl,
|
||||
importc: "threadExceptionIsAArch64".} =
|
||||
proc threadExceptionIsAArch64*(ctx: ptr ThreadExceptionDump): bool {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Determines whether a ThreadExceptionDump belongs to an AArch64 process based on the PSTATE.
|
||||
## @param[in] ctx ThreadExceptionDump.
|
||||
|
|
|
|||
|
|
@ -14,5 +14,5 @@ export types
|
|||
## @return The thread local storage buffer.
|
||||
##
|
||||
|
||||
proc armGetTls*(): pointer {.inline, cdecl, importc: "armGetTls".} =
|
||||
proc armGetTls*(): pointer {.inline, cdecl.} =
|
||||
{.emit: "__asm__ (\"mrs %x[data], tpidrro_el0\" : [data] \"=r\" (`result`));".}
|
||||
|
|
|
|||
|
|
@ -84,44 +84,36 @@ proc audrvVoiceSetBiquadFilter*(d: ptr AudioDriver; id: cint; biquadId: cint;
|
|||
b1: cfloat; b2: cfloat) {.cdecl,
|
||||
importc: "audrvVoiceSetBiquadFilter".}
|
||||
proc audrvVoiceSetExtraParams*(d: ptr AudioDriver; id: cint; params: pointer;
|
||||
paramsSize: csize_t) {.inline, cdecl,
|
||||
importc: "audrvVoiceSetExtraParams".} =
|
||||
paramsSize: csize_t) {.inline, cdecl.} =
|
||||
d.inVoices[id].extraParamsPtr = params
|
||||
d.inVoices[id].extraParamsSz = paramsSize
|
||||
|
||||
proc audrvVoiceSetDestinationMix*(d: ptr AudioDriver; id: cint; mixId: cint) {.inline,
|
||||
cdecl, importc: "audrvVoiceSetDestinationMix".} =
|
||||
proc audrvVoiceSetDestinationMix*(d: ptr AudioDriver; id: cint; mixId: cint) {.inline, cdecl.} =
|
||||
d.inVoices[id].destMixId = mixId.U32
|
||||
d.inVoices[id].destSplitterId = Audren_Unused_Splitter_Id.U32
|
||||
|
||||
proc audrvVoiceSetMixFactor*(d: ptr AudioDriver; id: cint; factor: cfloat;
|
||||
srcChannelId: cint; destChannelId: cint) {.inline, cdecl,
|
||||
importc: "audrvVoiceSetMixFactor".} =
|
||||
srcChannelId: cint; destChannelId: cint) {.inline, cdecl.} =
|
||||
var channelId = d.inVoices[id].channelIds[srcChannelId]
|
||||
d.inChannels[channelId].mix[destChannelId] = factor
|
||||
|
||||
proc audrvVoiceSetVolume*(d: ptr AudioDriver; id: cint; volume: cfloat) {.inline, cdecl,
|
||||
importc: "audrvVoiceSetVolume".} =
|
||||
proc audrvVoiceSetVolume*(d: ptr AudioDriver; id: cint; volume: cfloat) {.inline, cdecl.} =
|
||||
d.inVoices[id].volume = volume
|
||||
|
||||
proc audrvVoiceSetPitch*(d: ptr AudioDriver; id: cint; pitch: cfloat) {.inline, cdecl,
|
||||
importc: "audrvVoiceSetPitch".} =
|
||||
proc audrvVoiceSetPitch*(d: ptr AudioDriver; id: cint; pitch: cfloat) {.inline, cdecl.} =
|
||||
d.inVoices[id].pitch = pitch
|
||||
|
||||
proc audrvVoiceSetPriority*(d: ptr AudioDriver; id: cint; priority: cint) {.inline,
|
||||
cdecl, importc: "audrvVoiceSetPriority".} =
|
||||
proc audrvVoiceSetPriority*(d: ptr AudioDriver; id: cint; priority: cint) {.inline, cdecl.} =
|
||||
d.inVoices[id].priority = priority.U32
|
||||
|
||||
proc audrvVoiceClearBiquadFilter*(d: ptr AudioDriver; id: cint; biquadId: cint) {.
|
||||
inline, cdecl, importc: "audrvVoiceClearBiquadFilter".} =
|
||||
inline, cdecl.} =
|
||||
d.inVoices[id].biquads[biquadId].enable = false
|
||||
|
||||
proc audrvVoiceSetPaused*(d: ptr AudioDriver; id: cint; paused: bool) {.inline, cdecl,
|
||||
importc: "audrvVoiceSetPaused".} =
|
||||
proc audrvVoiceSetPaused*(d: ptr AudioDriver; id: cint; paused: bool) {.inline, cdecl.} =
|
||||
d.inVoices[id].state = if paused: AudioRendererVoicePlayStatePaused else: AudioRendererVoicePlayStateStarted
|
||||
|
||||
proc audrvVoiceStart*(d: ptr AudioDriver; id: cint) {.inline, cdecl,
|
||||
importc: "audrvVoiceStart".} =
|
||||
proc audrvVoiceStart*(d: ptr AudioDriver; id: cint) {.inline, cdecl.} =
|
||||
audrvVoiceSetPaused(d, id, false)
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
|
|
@ -129,18 +121,15 @@ proc audrvVoiceStart*(d: ptr AudioDriver; id: cint) {.inline, cdecl,
|
|||
proc audrvMixAdd*(d: ptr AudioDriver; sampleRate: cint; numChannels: cint): cint {.cdecl,
|
||||
importc: "audrvMixAdd".}
|
||||
proc audrvMixRemove*(d: ptr AudioDriver; id: cint) {.cdecl, importc: "audrvMixRemove".}
|
||||
proc audrvMixSetDestinationMix*(d: ptr AudioDriver; id: cint; mixId: cint) {.inline,
|
||||
cdecl, importc: "audrvMixSetDestinationMix".} =
|
||||
proc audrvMixSetDestinationMix*(d: ptr AudioDriver; id: cint; mixId: cint) {.inline, cdecl.} =
|
||||
d.inMixes[id].destMixId = mixId.U32
|
||||
d.inMixes[id].destSplitterId = Audren_Unused_Splitter_Id.U32
|
||||
|
||||
proc audrvMixSetMixFactor*(d: ptr AudioDriver; id: cint; factor: cfloat;
|
||||
srcChannelId: cint; destChannelId: cint) {.inline, cdecl,
|
||||
importc: "audrvMixSetMixFactor".} =
|
||||
srcChannelId: cint; destChannelId: cint) {.inline, cdecl.} =
|
||||
d.inMixes[id].mix[srcChannelId][destChannelId] = factor
|
||||
|
||||
proc audrvMixSetVolume*(d: ptr AudioDriver; id: cint; volume: cfloat) {.inline, cdecl,
|
||||
importc: "audrvMixSetVolume".} =
|
||||
proc audrvMixSetVolume*(d: ptr AudioDriver; id: cint; volume: cfloat) {.inline, cdecl.} =
|
||||
d.inMixes[id].volume = volume
|
||||
|
||||
## -----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -29,18 +29,14 @@ proc binderAdjustRefcount*(b: ptr Binder; addval: S32; `type`: S32): Result {.cd
|
|||
importc: "binderAdjustRefcount".}
|
||||
proc binderGetNativeHandle*(b: ptr Binder; unk0: U32; eventOut: ptr Event): Result {.
|
||||
cdecl, importc: "binderGetNativeHandle".}
|
||||
proc binderIncreaseWeakRef*(b: ptr Binder): Result {.inline, cdecl,
|
||||
importc: "binderIncreaseWeakRef".} =
|
||||
proc binderIncreaseWeakRef*(b: ptr Binder): Result {.inline, cdecl.} =
|
||||
return binderAdjustRefcount(b, 1, 0)
|
||||
|
||||
proc binderDecreaseWeakRef*(b: ptr Binder): Result {.inline, cdecl,
|
||||
importc: "binderDecreaseWeakRef".} =
|
||||
proc binderDecreaseWeakRef*(b: ptr Binder): Result {.inline, cdecl.} =
|
||||
return binderAdjustRefcount(b, -1, 0)
|
||||
|
||||
proc binderIncreaseStrongRef*(b: ptr Binder): Result {.inline, cdecl,
|
||||
importc: "binderIncreaseStrongRef".} =
|
||||
proc binderIncreaseStrongRef*(b: ptr Binder): Result {.inline, cdecl.} =
|
||||
return binderAdjustRefcount(b, 1, 1)
|
||||
|
||||
proc binderDecreaseStrongRef*(b: ptr Binder): Result {.inline, cdecl,
|
||||
importc: "binderDecreaseStrongRef".} =
|
||||
proc binderDecreaseStrongRef*(b: ptr Binder): Result {.inline, cdecl.} =
|
||||
return binderAdjustRefcount(b, -1, 1)
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ type
|
|||
## @param[in] c Condition variable object.
|
||||
##
|
||||
|
||||
proc condvarInit*(c: ptr CondVar) {.inline, cdecl, importc: "condvarInit".} =
|
||||
proc condvarInit*(c: ptr CondVar) {.inline, cdecl.} =
|
||||
c[] = 0
|
||||
|
||||
## *
|
||||
|
|
@ -40,8 +40,7 @@ proc condvarWaitTimeout*(c: ptr CondVar; m: ptr Mutex; timeout: U64): Result {.c
|
|||
## @remark On function return, the underlying mutex is acquired.
|
||||
##
|
||||
|
||||
proc condvarWait*(c: ptr CondVar; m: ptr Mutex): Result {.inline, cdecl,
|
||||
importc: "condvarWait".} =
|
||||
proc condvarWait*(c: ptr CondVar; m: ptr Mutex): Result {.inline, cdecl.} =
|
||||
return condvarWaitTimeout(c, m, uint64.high)
|
||||
|
||||
## *
|
||||
|
|
@ -51,8 +50,7 @@ proc condvarWait*(c: ptr CondVar; m: ptr Mutex): Result {.inline, cdecl,
|
|||
## @return Result code.
|
||||
##
|
||||
|
||||
proc condvarWake*(c: ptr CondVar; num: cint): Result {.inline, cdecl,
|
||||
importc: "condvarWake".} =
|
||||
proc condvarWake*(c: ptr CondVar; num: cint): Result {.inline, cdecl.} =
|
||||
svcSignalProcessWideKey(c, num)
|
||||
return 0
|
||||
|
||||
|
|
@ -62,7 +60,7 @@ proc condvarWake*(c: ptr CondVar; num: cint): Result {.inline, cdecl,
|
|||
## @return Result code.
|
||||
##
|
||||
|
||||
proc condvarWakeOne*(c: ptr CondVar): Result {.inline, cdecl, importc: "condvarWakeOne".} =
|
||||
proc condvarWakeOne*(c: ptr CondVar): Result {.inline, cdecl.} =
|
||||
return condvarWake(c, 1)
|
||||
|
||||
## *
|
||||
|
|
@ -71,5 +69,5 @@ proc condvarWakeOne*(c: ptr CondVar): Result {.inline, cdecl, importc: "condvarW
|
|||
## @return Result code.
|
||||
##
|
||||
|
||||
proc condvarWakeAll*(c: ptr CondVar): Result {.inline, cdecl, importc: "condvarWakeAll".} =
|
||||
proc condvarWakeAll*(c: ptr CondVar): Result {.inline, cdecl.} =
|
||||
return condvarWake(c, -1)
|
||||
|
|
|
|||
|
|
@ -10,14 +10,14 @@ import
|
|||
|
||||
## / Returns true if the process has a debugger attached.
|
||||
|
||||
proc detectDebugger*(): bool {.inline, cdecl, importc: "detectDebugger".} =
|
||||
proc detectDebugger*(): bool {.inline, cdecl.} =
|
||||
var tmp: U64 = 0
|
||||
var rc: Result = svcGetInfo(addr(tmp), InfoTypeDebuggerAttached.uint32, Invalid_Handle, 0)
|
||||
return r_Succeeded(rc) and tmp != 0
|
||||
|
||||
## / Returns true if the underlying kernel is Mesosphère.
|
||||
|
||||
proc detectMesosphere*(): bool {.inline, cdecl, importc: "detectMesosphere".} =
|
||||
proc detectMesosphere*(): bool {.inline, cdecl.} =
|
||||
var dummy: U64 = 0
|
||||
var rc: Result = svcGetInfo(addr(dummy), 65000, Invalid_Handle, 0)
|
||||
## InfoType_MesosphereMeta
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ type
|
|||
wevent*: Handle ## /< Write-only event handle
|
||||
autoclear*: bool ## /< Autoclear flag
|
||||
|
||||
proc waiterForEvent*(t: ptr Event): Waiter {.inline, cdecl, importc: "waiterForEvent".} =
|
||||
proc waiterForEvent*(t: ptr Event): Waiter {.inline, cdecl.} =
|
||||
## / Creates a \ref Waiter for a kernel-mode event.
|
||||
var waitObj: Waiter
|
||||
waitObj.`type` = if t.autoclear: WaiterTypeHandleWithClear else: WaiterTypeHandle
|
||||
|
|
@ -47,7 +47,7 @@ proc eventClose*(t: ptr Event) {.cdecl, importc: "eventClose".}
|
|||
## @param[in] t Pointer to \ref Event structure.
|
||||
##
|
||||
|
||||
proc eventActive*(t: ptr Event): bool {.inline, cdecl, importc: "eventActive".} =
|
||||
proc eventActive*(t: ptr Event): bool {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Returns whether an \ref Event is initialized.
|
||||
## @param[in] t Pointer to \ref Event structure.
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ proc jitClose*(j: ptr Jit): Result {.cdecl, importc: "jitClose".}
|
|||
## @return Pointer to alias of the JIT buffer that can be written to.
|
||||
##
|
||||
|
||||
proc jitGetRwAddr*(j: ptr Jit): pointer {.inline, cdecl, importc: "jitGetRwAddr".} =
|
||||
proc jitGetRwAddr*(j: ptr Jit): pointer {.inline, cdecl.} =
|
||||
return j.rwAddr
|
||||
|
||||
## *
|
||||
|
|
@ -79,5 +79,5 @@ proc jitGetRwAddr*(j: ptr Jit): pointer {.inline, cdecl, importc: "jitGetRwAddr"
|
|||
## @return Pointer to alias of the JIT buffer that can be executed.
|
||||
##
|
||||
|
||||
proc jitGetRxAddr*(j: ptr Jit): pointer {.inline, cdecl, importc: "jitGetRxAddr".} =
|
||||
proc jitGetRxAddr*(j: ptr Jit): pointer {.inline, cdecl.} =
|
||||
return j.rxAddr
|
||||
|
|
|
|||
|
|
@ -15,8 +15,7 @@ type
|
|||
counter*: U32
|
||||
autoclear*: bool
|
||||
|
||||
proc leventInit*(le: ptr LEvent; signaled: bool; autoclear: bool) {.inline, cdecl,
|
||||
importc: "leventInit".} =
|
||||
proc leventInit*(le: ptr LEvent; signaled: bool; autoclear: bool) {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Initializes a user-mode light event.
|
||||
## @param[out] le Pointer to \ref LEvent structure.
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ type
|
|||
## @note A mutex can also be statically initialized by assigning 0 to it.
|
||||
##
|
||||
|
||||
proc mutexInit*(m: ptr Mutex) {.inline, cdecl, importc: "mutexInit".} =
|
||||
proc mutexInit*(m: ptr Mutex) {.inline, cdecl.} =
|
||||
m[] = INVALID_HANDLE.Mutex
|
||||
|
||||
## *
|
||||
|
|
@ -64,7 +64,7 @@ proc mutexIsLockedByCurrentThread*(m: ptr Mutex): bool {.cdecl,
|
|||
## @note A recursive mutex can also be statically initialized by assigning {0,0,0} to it.
|
||||
##
|
||||
|
||||
proc rmutexInit*(m: ptr RMutex) {.inline, cdecl, importc: "rmutexInit".} =
|
||||
proc rmutexInit*(m: ptr RMutex) {.inline, cdecl.} =
|
||||
m.lock = 0.Lock
|
||||
m.threadTag = 0
|
||||
m.counter = 0
|
||||
|
|
|
|||
|
|
@ -20,4 +20,4 @@ proc randomGet*(buf: pointer; len: csize_t) {.cdecl, importc: "randomGet".}
|
|||
## @return Random value.
|
||||
##
|
||||
|
||||
proc randomGet64*(): U64 {.cdecl, importc: "randomGet64".}
|
||||
proc randomGet64*(): U64 {.cdecl, importc: "randomGet64".}
|
||||
|
|
|
|||
|
|
@ -564,8 +564,7 @@ proc svcWaitSynchronization*(index: ptr S32; handles: ptr Handle; handleCount: S
|
|||
## @note This is the raw syscall, which can be cancelled by \ref svcCancelSynchronization or other means. \ref waitHandles or \ref waitMultiHandle should normally be used instead.
|
||||
##
|
||||
|
||||
proc svcWaitSynchronizationSingle*(handle: Handle; timeout: U64): Result {.inline,
|
||||
cdecl, importc: "svcWaitSynchronizationSingle".} =
|
||||
proc svcWaitSynchronizationSingle*(handle: Handle; timeout: U64): Result {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Waits on a single synchronization object, optionally with a timeout.
|
||||
## @return Result code.
|
||||
|
|
|
|||
|
|
@ -21,8 +21,7 @@ type
|
|||
next*: ptr Thread
|
||||
prevNext*: ptr ptr Thread
|
||||
|
||||
proc waiterForThread*(t: ptr Thread): Waiter {.inline, cdecl,
|
||||
importc: "waiterForThread".} =
|
||||
proc waiterForThread*(t: ptr Thread): Waiter {.inline, cdecl.} =
|
||||
## / Creates a \ref Waiter for a \ref Thread.
|
||||
return waiterForHandle(t.handle)
|
||||
|
||||
|
|
|
|||
|
|
@ -75,8 +75,7 @@ proc tmemUnmap*(t: ptr TransferMemory): Result {.cdecl, importc: "tmemUnmap".}
|
|||
## @return Mapped address of the transfer memory object.
|
||||
##
|
||||
|
||||
proc tmemGetAddr*(t: ptr TransferMemory): pointer {.inline, cdecl,
|
||||
importc: "tmemGetAddr".} =
|
||||
proc tmemGetAddr*(t: ptr TransferMemory): pointer {.inline, cdecl.} =
|
||||
return t.mapAddr
|
||||
|
||||
## *
|
||||
|
|
|
|||
|
|
@ -26,8 +26,7 @@ type
|
|||
nextTick*: U64
|
||||
interval*: U64
|
||||
|
||||
proc waiterForUTimer*(t: ptr UTimer): Waiter {.inline, cdecl,
|
||||
importc: "waiterForUTimer".} =
|
||||
proc waiterForUTimer*(t: ptr UTimer): Waiter {.inline, cdecl.} =
|
||||
## / Creates a waiter for a user-mode timer.
|
||||
var waitObj: Waiter
|
||||
waitObj.`type` = WaiterTypeWaitable
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ type
|
|||
|
||||
## / Creates a \ref Waiter for a kernel-mode \ref Handle.
|
||||
|
||||
proc waiterForHandle*(h: Handle): Waiter {.inline, cdecl, importc: "waiterForHandle".} =
|
||||
proc waiterForHandle*(h: Handle): Waiter {.inline, cdecl.} =
|
||||
var waitObj: Waiter
|
||||
waitObj.`type` = WaiterTypeHandle
|
||||
waitObj.anoWait3.handle = h
|
||||
|
|
@ -98,7 +98,7 @@ proc waitHandles*(idxOut: ptr S32; handles: ptr Handle; numHandles: S32; timeout
|
|||
## @param[in] timeout Timeout (in nanoseconds).
|
||||
##
|
||||
|
||||
proc waitSingle*(w: Waiter; timeout: U64): Result {.inline, cdecl, importc: "waitSingle".} =
|
||||
proc waitSingle*(w: Waiter; timeout: U64): Result {.inline, cdecl.} =
|
||||
var idx: S32
|
||||
return waitObjects(addr(idx), addr(w), 1, timeout)
|
||||
|
||||
|
|
@ -108,7 +108,6 @@ proc waitSingle*(w: Waiter; timeout: U64): Result {.inline, cdecl, importc: "wai
|
|||
## @param[in] timeout Timeout (in nanoseconds).
|
||||
##
|
||||
|
||||
proc waitSingleHandle*(h: Handle; timeout: U64): Result {.inline, cdecl,
|
||||
importc: "waitSingleHandle".} =
|
||||
proc waitSingleHandle*(h: Handle; timeout: U64): Result {.inline, cdecl.} =
|
||||
var idx: S32
|
||||
return waitHandles(addr(idx), addr(h), 1, timeout)
|
||||
|
|
|
|||
|
|
@ -12,8 +12,7 @@ proc nvFenceInit*(): Result {.cdecl, importc: "nvFenceInit".}
|
|||
proc nvFenceExit*() {.cdecl, importc: "nvFenceExit".}
|
||||
proc nvFenceWait*(f: ptr NvFence; timeoutUs: S32): Result {.cdecl,
|
||||
importc: "nvFenceWait".}
|
||||
proc nvMultiFenceCreate*(mf: ptr NvMultiFence; fence: ptr NvFence) {.inline, cdecl,
|
||||
importc: "nvMultiFenceCreate".} =
|
||||
proc nvMultiFenceCreate*(mf: ptr NvMultiFence; fence: ptr NvFence) {.inline, cdecl.} =
|
||||
mf.numFences = 1
|
||||
mf.fences[0] = fence[]
|
||||
|
||||
|
|
|
|||
|
|
@ -33,15 +33,12 @@ proc nvGpuChannelGetErrorNotification*(c: ptr NvGpuChannel;
|
|||
importc: "nvGpuChannelGetErrorNotification".}
|
||||
proc nvGpuChannelGetErrorInfo*(c: ptr NvGpuChannel; error: ptr NvError): Result {.cdecl,
|
||||
importc: "nvGpuChannelGetErrorInfo".}
|
||||
proc nvGpuChannelGetSyncpointId*(c: ptr NvGpuChannel): U32 {.inline, cdecl,
|
||||
importc: "nvGpuChannelGetSyncpointId".} =
|
||||
proc nvGpuChannelGetSyncpointId*(c: ptr NvGpuChannel): U32 {.inline, cdecl.} =
|
||||
return c.fence.id
|
||||
|
||||
proc nvGpuChannelGetFence*(c: ptr NvGpuChannel; fenceOut: ptr NvFence) {.inline, cdecl,
|
||||
importc: "nvGpuChannelGetFence".} =
|
||||
proc nvGpuChannelGetFence*(c: ptr NvGpuChannel; fenceOut: ptr NvFence) {.inline, cdecl.} =
|
||||
fenceOut.id = c.fence.id
|
||||
fenceOut.value = c.fence.value + c.fenceIncr
|
||||
|
||||
proc nvGpuChannelIncrFence*(c: ptr NvGpuChannel) {.inline, cdecl,
|
||||
importc: "nvGpuChannelIncrFence".} =
|
||||
proc nvGpuChannelIncrFence*(c: ptr NvGpuChannel) {.inline, cdecl.} =
|
||||
inc(c.fenceIncr)
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@ proc usbCommsReadEx*(buffer: pointer; size: csize_t; `interface`: U32): csize_t
|
|||
## / Same as usbCommsWrite except with the specified interface.
|
||||
|
||||
proc usbCommsWriteEx*(buffer: pointer; size: csize_t; `interface`: U32): csize_t {.
|
||||
cdecl, importc: "usbCommsWriteEx".}
|
||||
cdecl, importc: "usbCommsWriteEx".}
|
||||
|
|
|
|||
|
|
@ -13,4 +13,4 @@ import
|
|||
## @param[in] res Result code.
|
||||
##
|
||||
|
||||
proc diagAbortWithResult*(res: Result) {.cdecl, importc: "diagAbortWithResult".}
|
||||
proc diagAbortWithResult*(res: Result) {.cdecl, importc: "diagAbortWithResult".}
|
||||
|
|
|
|||
|
|
@ -29,10 +29,10 @@ proc nxlinkConnectToHost*(redirStdout: bool; redirStderr: bool): cint {.cdecl,
|
|||
## @note The socket should be closed with close() during application cleanup.
|
||||
##
|
||||
|
||||
proc nxlinkStdio*(): cint {.inline, cdecl, importc: "nxlinkStdio".} =
|
||||
proc nxlinkStdio*(): cint {.inline, cdecl.} =
|
||||
## / Same as \ref nxlinkConnectToHost but redirecting both stdout/stderr.
|
||||
return nxlinkConnectToHost(true, true)
|
||||
|
||||
proc nxlinkStdioForDebug*(): cint {.inline, cdecl, importc: "nxlinkStdioForDebug".} =
|
||||
proc nxlinkStdioForDebug*(): cint {.inline, cdecl.} =
|
||||
## / Same as \ref nxlinkConnectToHost but redirecting only stderr.
|
||||
return nxlinkConnectToHost(false, true)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ proc padConfigureInput*(maxPlayers: U32; styleSet: U32) {.cdecl,
|
|||
## @brief Same as \ref padInitialize, but taking a bitfield of controller IDs directly.
|
||||
## @param[in] pad Pointer to \ref PadState.
|
||||
## @param[in] mask Bitfield of controller IDs (each bit's position indicates a different \ref HidNpadIdType value).
|
||||
proc padInitializeWithMask*(pad: ptr PadState, mask: U64) {.inline, cdecl, importc: "padInitializeWithMask".}
|
||||
proc padInitializeWithMask*(pad: ptr PadState, mask: U64) {.cdecl, importc: "padInitializeWithMask".}
|
||||
|
||||
proc padInitialize*(pad: ptr PadState, padIds: varargs[HidNpadIdType]) {.inline, cdecl.} =
|
||||
var mask: U64 = 0
|
||||
|
|
@ -71,7 +71,7 @@ proc padInitialize*(pad: ptr PadState, padIds: varargs[HidNpadIdType]) {.inline,
|
|||
## @remark Use this function if you want to accept input from any controller.
|
||||
##
|
||||
|
||||
proc padInitializeAny*(pad: ptr PadState) {.inline, cdecl, importc: "padInitializeAny".} =
|
||||
proc padInitializeAny*(pad: ptr PadState) {.inline, cdecl.} =
|
||||
padInitializeWithMask(pad, Pad_Any_Id_Mask)
|
||||
|
||||
## *
|
||||
|
|
@ -80,8 +80,7 @@ proc padInitializeAny*(pad: ptr PadState) {.inline, cdecl, importc: "padInitiali
|
|||
## @remark Use this function if you just want to accept input for a single-player application.
|
||||
##
|
||||
|
||||
proc padInitializeDefault*(pad: ptr PadState) {.inline, cdecl,
|
||||
importc: "padInitializeDefault".} =
|
||||
proc padInitializeDefault*(pad: ptr PadState) {.inline, cdecl.} =
|
||||
padInitialize(pad, HidNpadIdTypeNo1, HidNpadIdTypeHandheld)
|
||||
|
||||
## *
|
||||
|
|
@ -97,7 +96,7 @@ proc padUpdate*(pad: ptr PadState) {.cdecl, importc: "padUpdate".}
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padIsHandheld*(pad: ptr PadState): bool {.inline, cdecl, importc: "padIsHandheld".} =
|
||||
proc padIsHandheld*(pad: ptr PadState): bool {.inline, cdecl.} =
|
||||
return pad.activeHandheld
|
||||
|
||||
## *
|
||||
|
|
@ -108,8 +107,7 @@ proc padIsHandheld*(pad: ptr PadState): bool {.inline, cdecl, importc: "padIsHan
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padIsNpadActive*(pad: ptr PadState; id: HidNpadIdType): bool {.inline, cdecl,
|
||||
importc: "padIsNpadActive".} =
|
||||
proc padIsNpadActive*(pad: ptr PadState; id: HidNpadIdType): bool {.inline, cdecl.} =
|
||||
if id <= HidNpadIdTypeNo8:
|
||||
return bool(pad.activeIdMask and (bit(id.uint8)))
|
||||
elif id == HidNpadIdTypeHandheld:
|
||||
|
|
@ -124,7 +122,7 @@ proc padIsNpadActive*(pad: ptr PadState; id: HidNpadIdType): bool {.inline, cdec
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padGetStyleSet*(pad: ptr PadState): U32 {.inline, cdecl, importc: "padGetStyleSet".} =
|
||||
proc padGetStyleSet*(pad: ptr PadState): U32 {.inline, cdecl.} =
|
||||
return pad.styleSet
|
||||
|
||||
## *
|
||||
|
|
@ -134,8 +132,7 @@ proc padGetStyleSet*(pad: ptr PadState): U32 {.inline, cdecl, importc: "padGetSt
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padGetAttributes*(pad: ptr PadState): U32 {.inline, cdecl,
|
||||
importc: "padGetAttributes".} =
|
||||
proc padGetAttributes*(pad: ptr PadState): U32 {.inline, cdecl.} =
|
||||
return pad.attributes
|
||||
|
||||
## *
|
||||
|
|
@ -145,8 +142,7 @@ proc padGetAttributes*(pad: ptr PadState): U32 {.inline, cdecl,
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padIsConnected*(pad: ptr PadState): bool {.inline, cdecl,
|
||||
importc: "padIsConnected".} =
|
||||
proc padIsConnected*(pad: ptr PadState): bool {.inline, cdecl.} =
|
||||
return bool(pad.attributes and HidNpadAttributeIsConnected.uint32)
|
||||
|
||||
## *
|
||||
|
|
@ -156,7 +152,7 @@ proc padIsConnected*(pad: ptr PadState): bool {.inline, cdecl,
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padGetButtons*(pad: ptr PadState): U64 {.inline, cdecl, importc: "padGetButtons".} =
|
||||
proc padGetButtons*(pad: ptr PadState): U64 {.inline, cdecl.} =
|
||||
return pad.buttonsCur
|
||||
|
||||
## *
|
||||
|
|
@ -166,8 +162,7 @@ proc padGetButtons*(pad: ptr PadState): U64 {.inline, cdecl, importc: "padGetBut
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padGetButtonsDown*(pad: ptr PadState): U64 {.inline, cdecl,
|
||||
importc: "padGetButtonsDown".} =
|
||||
proc padGetButtonsDown*(pad: ptr PadState): U64 {.inline, cdecl.} =
|
||||
return not pad.buttonsOld and pad.buttonsCur
|
||||
|
||||
## *
|
||||
|
|
@ -177,8 +172,7 @@ proc padGetButtonsDown*(pad: ptr PadState): U64 {.inline, cdecl,
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padGetButtonsUp*(pad: ptr PadState): U64 {.inline, cdecl,
|
||||
importc: "padGetButtonsUp".} =
|
||||
proc padGetButtonsUp*(pad: ptr PadState): U64 {.inline, cdecl.} =
|
||||
return pad.buttonsOld and not pad.buttonsCur
|
||||
|
||||
## *
|
||||
|
|
@ -189,8 +183,7 @@ proc padGetButtonsUp*(pad: ptr PadState): U64 {.inline, cdecl,
|
|||
## @remark \ref padUpdate must have been previously called.
|
||||
##
|
||||
|
||||
proc padGetStickPos*(pad: ptr PadState; i: cuint): HidAnalogStickState {.inline, cdecl,
|
||||
importc: "padGetStickPos".} =
|
||||
proc padGetStickPos*(pad: ptr PadState; i: cuint): HidAnalogStickState {.inline, cdecl.} =
|
||||
return pad.sticks[i]
|
||||
|
||||
## *
|
||||
|
|
@ -202,8 +195,7 @@ proc padGetStickPos*(pad: ptr PadState; i: cuint): HidAnalogStickState {.inline,
|
|||
## @remark \ref HidNpadStyleTag_NpadGc must have been previously configured as a supported style in \ref padConfigureInput for GC trigger data to be readable.
|
||||
##
|
||||
|
||||
proc padGetGcTriggerPos*(pad: ptr PadState; i: cuint): U32 {.inline, cdecl,
|
||||
importc: "padGetGcTriggerPos".} =
|
||||
proc padGetGcTriggerPos*(pad: ptr PadState; i: cuint): U32 {.inline, cdecl.} =
|
||||
return pad.gcTriggers[i]
|
||||
|
||||
## *
|
||||
|
|
@ -213,8 +205,7 @@ proc padGetGcTriggerPos*(pad: ptr PadState; i: cuint): U32 {.inline, cdecl,
|
|||
## @param[in] repeat Number of input updates between autogenerated repeat button presses.
|
||||
##
|
||||
|
||||
proc padRepeaterInitialize*(r: ptr PadRepeater; delay: U16; repeat: U16) {.inline, cdecl,
|
||||
importc: "padRepeaterInitialize".} =
|
||||
proc padRepeaterInitialize*(r: ptr PadRepeater; delay: U16; repeat: U16) {.inline, cdecl.} =
|
||||
r.buttonMask = 0
|
||||
r.counter = 0
|
||||
r.delay = delay
|
||||
|
|
@ -235,6 +226,5 @@ proc padRepeaterUpdate*(r: ptr PadRepeater; buttonMask: U64) {.cdecl,
|
|||
## @remark It is suggested to bitwise-OR the return value of this function with that of \ref padGetButtonsDown.
|
||||
##
|
||||
|
||||
proc padRepeaterGetButtons*(r: ptr PadRepeater): U64 {.inline, cdecl,
|
||||
importc: "padRepeaterGetButtons".} =
|
||||
proc padRepeaterGetButtons*(r: ptr PadRepeater): U64 {.inline, cdecl.} =
|
||||
return if r.counter == 0: r.buttonMask else: 0
|
||||
|
|
|
|||
|
|
@ -129,6 +129,5 @@ proc accountGetPreselectedUser*(uid: ptr AccountUid): Result {.cdecl,
|
|||
## @param[in] Uid \ref AccountUid
|
||||
##
|
||||
|
||||
proc accountUidIsValid*(uid: ptr AccountUid): bool {.inline, cdecl,
|
||||
importc: "accountUidIsValid".} =
|
||||
proc accountUidIsValid*(uid: ptr AccountUid): bool {.inline, cdecl.} =
|
||||
return uid.uid[0] != 0 or uid.uid[1] != 0
|
||||
|
|
|
|||
|
|
@ -247,16 +247,14 @@ type
|
|||
|
||||
|
||||
|
||||
proc audrenGetRevision*(): U32 {.inline, cdecl, importc: "audrenGetRevision".} =
|
||||
proc audrenGetRevision*(): U32 {.inline, cdecl.} =
|
||||
var gAudrenRevision: U32
|
||||
return gAudrenRevision
|
||||
|
||||
proc audrenGetMemPoolCount*(config: ptr AudioRendererConfig): cint {.inline, cdecl,
|
||||
importc: "audrenGetMemPoolCount".} =
|
||||
proc audrenGetMemPoolCount*(config: ptr AudioRendererConfig): cint {.inline, cdecl.} =
|
||||
return config.numEffects + 4 * config.numVoices
|
||||
|
||||
proc audrenGetInputParamSize*(config: ptr AudioRendererConfig): csize_t {.inline,
|
||||
cdecl, importc: "audrenGetInputParamSize".} =
|
||||
proc audrenGetInputParamSize*(config: ptr AudioRendererConfig): csize_t {.inline, cdecl.} =
|
||||
var size: csize_t = 0
|
||||
inc(size, sizeof((AudioRendererUpdateDataHeader)))
|
||||
inc(size, sizeof((AudioRendererBehaviorInfoIn)))
|
||||
|
|
@ -270,8 +268,7 @@ proc audrenGetInputParamSize*(config: ptr AudioRendererConfig): csize_t {.inline
|
|||
inc(size, sizeof((AudioRendererPerformanceBufferInfoIn)))
|
||||
return size
|
||||
|
||||
proc audrenGetOutputParamSize*(config: ptr AudioRendererConfig): csize_t {.inline,
|
||||
cdecl, importc: "audrenGetOutputParamSize".} =
|
||||
proc audrenGetOutputParamSize*(config: ptr AudioRendererConfig): csize_t {.inline, cdecl.} =
|
||||
var size: csize_t = 0
|
||||
inc(size, sizeof((AudioRendererUpdateDataHeader)))
|
||||
inc(size, sizeof((AudioRendererMemPoolInfoOut)) *
|
||||
|
|
|
|||
|
|
@ -24,6 +24,16 @@ type
|
|||
udpRxBufSize*: U32 ## /< Size of the UDP receive buffer (typically 0xA500 bytes).
|
||||
sbEfficiency*: U32 ## /< Number of buffers for each socket (standard values range from 1 to 8).
|
||||
|
||||
type
|
||||
SockAddr* = object
|
||||
FdSet* = object
|
||||
TimeVal* = object
|
||||
NfdsT* = uint
|
||||
PollFd* = object
|
||||
SockLenT* = uint32
|
||||
TimeSpec* = object
|
||||
tv_sec: clong
|
||||
tv_nsec: clong
|
||||
|
||||
var gBsdResult* {.importc: "g_bsdResult".}: Result
|
||||
|
||||
|
|
|
|||
|
|
@ -251,22 +251,19 @@ proc capsGetDefaultStartDateTime*(): CapsAlbumFileDateTime {.inline, cdecl.} =
|
|||
## / Gets the default start_datetime.
|
||||
return CapsAlbumFileDateTime(year: 1970, month: 1, day: 1)
|
||||
|
||||
proc capsGetDefaultEndDateTime*(): CapsAlbumFileDateTime {.inline, cdecl,
|
||||
importc: "capsGetDefaultEndDateTime".} =
|
||||
proc capsGetDefaultEndDateTime*(): CapsAlbumFileDateTime {.inline, cdecl.} =
|
||||
## / Gets the default end_datetime.
|
||||
return CapsAlbumFileDateTime(year: 3000,month: 1,day: 1)
|
||||
|
||||
proc capsConvertApplicationAlbumFileEntryToApplicationAlbumEntry*(
|
||||
`out`: ptr CapsApplicationAlbumEntry; `in`: ptr CapsApplicationAlbumFileEntry) {.
|
||||
inline, cdecl,
|
||||
importc: "capsConvertApplicationAlbumFileEntryToApplicationAlbumEntry".} =
|
||||
inline, cdecl.} =
|
||||
## / Convert a \ref CapsApplicationAlbumFileEntry to \ref CapsApplicationAlbumEntry.
|
||||
`out`[] = `in`.entry
|
||||
|
||||
proc capsConvertApplicationAlbumEntryToApplicationAlbumFileEntry*(
|
||||
`out`: ptr CapsApplicationAlbumFileEntry; `in`: ptr CapsApplicationAlbumEntry) {.
|
||||
inline, cdecl,
|
||||
importc: "capsConvertApplicationAlbumEntryToApplicationAlbumFileEntry".} =
|
||||
inline, cdecl.} =
|
||||
## / Convert a \ref CapsApplicationAlbumEntry to \ref CapsApplicationAlbumFileEntry. Should only be used on [7.0.0+].
|
||||
`out`.entry = `in`[]
|
||||
`out`.datetime = `in`[].v1.datetime
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ proc friendsGetUserSetting*(uid: AccountUid; userSetting: ptr FriendsUserSetting
|
|||
##
|
||||
|
||||
proc friendsGetFriendInvitationNotificationEvent*(outEvent: ptr Event): Result {.
|
||||
inline, cdecl, importc: "friendsGetFriendInvitationNotificationEvent".} =
|
||||
inline, cdecl.} =
|
||||
return appletGetFriendInvitationStorageChannelEvent(outEvent)
|
||||
|
||||
## *
|
||||
|
|
|
|||
|
|
@ -1360,7 +1360,7 @@ proc hidGetKeyboardStates*(states: ptr HidKeyboardState; count: csize_t): csize_
|
|||
##
|
||||
|
||||
proc hidKeyboardStateGetKey*(state: ptr HidKeyboardState; key: HidKeyboardKey): bool {.
|
||||
inline, cdecl, importc: "hidKeyboardStateGetKey".} =
|
||||
inline, cdecl.} =
|
||||
## *
|
||||
## @brief Gets the state of a key in a \ref HidKeyboardState.
|
||||
## @param[in] state \ref HidKeyboardState.
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ const
|
|||
HTCS_PORT_NAME_MAX* = 32
|
||||
HTCS_SESSION_COUNT_MAX* = 0x10
|
||||
HTCS_SOCKET_COUNT_MAX* = 40
|
||||
HTCS_FD_SET_SIZE* = htcs_Socket_Count_Max
|
||||
HTCS_FD_SET_SIZE* = Htcs_Socket_Count_Max
|
||||
|
||||
type
|
||||
HtcsAddressFamilyType* = uint16
|
||||
HtcsPeerName* {.bycopy.} = object
|
||||
name*: array[htcs_Peer_Name_Max, char]
|
||||
name*: array[Htcs_Peer_Name_Max, char]
|
||||
|
||||
HtcsPortName* {.bycopy.} = object
|
||||
name*: array[htcs_Port_Name_Max, char]
|
||||
name*: array[Htcs_Port_Name_Max, char]
|
||||
|
||||
HtcsSockAddr* {.bycopy.} = object
|
||||
family*: HtcsAddressFamilyType
|
||||
|
|
@ -33,7 +33,7 @@ type
|
|||
tvUsec*: S64
|
||||
|
||||
HtcsFdSet* {.bycopy.} = object
|
||||
fds*: array[htcs_Fd_Set_Size, cint]
|
||||
fds*: array[Htcs_Fd_Set_Size, cint]
|
||||
|
||||
HtcsSocketError* = enum
|
||||
HTCS_ENONE = 0, HTCS_EACCES = 2, HTCS_EADDRINUSE = 3, HTCS_EADDRNOTAVAIL = 4,
|
||||
|
|
@ -43,7 +43,6 @@ type
|
|||
HTCS_EINVAL = 28, HTCS_EIO = 29, HTCS_EISCONN = 30, HTCS_EMFILE = 33,
|
||||
HTCS_EMSGSIZE = 35, HTCS_ENETDOWN = 38, HTCS_ENETRESET = 39, HTCS_ENOBUFS = 42,
|
||||
HTCS_ENOMEM = 49, HTCS_ENOTCONN = 56, HTCS_ETIMEDOUT = 76, HTCS_EUNKNOWN = 79,
|
||||
HTCS_EWOULDBLOCK = htcs_Eagain
|
||||
HtcsMessageFlag* = enum
|
||||
HTCS_MSG_PEEK = 1, HTCS_MSG_WAITALL = 2
|
||||
HtcsShutdownType* = enum
|
||||
|
|
@ -58,30 +57,31 @@ type
|
|||
s*: Service
|
||||
|
||||
|
||||
const HTCS_EWOULDBLOCK* = Htcs_Eagain
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
## / Initialize the HTCS service.
|
||||
|
||||
proc htcsInitialize*(numSessions: U32): Result {.cdecl, importc: "htcsInitialize".}
|
||||
## / Exit the HTCS service.
|
||||
## / Initialize the HTCS service.
|
||||
|
||||
proc htcsExit*() {.cdecl, importc: "htcsExit".}
|
||||
## / Gets the Service object for the actual HTCS manager service session.
|
||||
## / Exit the HTCS service.
|
||||
|
||||
proc htcsGetManagerServiceSession*(): ptr Service {.cdecl,
|
||||
importc: "htcsGetManagerServiceSession".}
|
||||
## / Gets the Service object for the actual HTCS monitor service session.
|
||||
## / Gets the Service object for the actual HTCS manager service session.
|
||||
|
||||
proc htcsGetMonitorServiceSession*(): ptr Service {.cdecl,
|
||||
importc: "htcsGetMonitorServiceSession".}
|
||||
## / Manager functionality.
|
||||
## / Gets the Service object for the actual HTCS monitor service session.
|
||||
|
||||
proc htcsGetPeerNameAny*(`out`: ptr HtcsPeerName): Result {.cdecl,
|
||||
importc: "htcsGetPeerNameAny".}
|
||||
## / Manager functionality.
|
||||
proc htcsGetDefaultHostName*(`out`: ptr HtcsPeerName): Result {.cdecl,
|
||||
importc: "htcsGetDefaultHostName".}
|
||||
proc htcsCreateSocket*(outErr: ptr S32; `out`: ptr HtcsSocket;
|
||||
|
|
@ -95,6 +95,7 @@ proc htcsEndSelect*(outErr: ptr S32; outCount: ptr S32; read: ptr S32; numRead:
|
|||
write: ptr S32; numWrite: csize_t; `except`: ptr S32;
|
||||
numExcept: csize_t; taskId: U32): Result {.cdecl,
|
||||
importc: "htcsEndSelect".}
|
||||
|
||||
## / Socket functionality.
|
||||
|
||||
proc htcsSocketClose*(s: ptr HtcsSocket; outErr: ptr S32; outRes: ptr S32): Result {.cdecl,
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ proc notifAlarmSettingSetIsMuted*(alarmSetting: ptr NotifAlarmSetting; flag: boo
|
|||
alarmSetting.muted = flag.U8
|
||||
|
||||
proc notifAlarmSettingSetUid*(alarmSetting: ptr NotifAlarmSetting; uid: AccountUid) {.
|
||||
inline, cdecl, importc: "notifAlarmSettingSetUid".} =
|
||||
inline, cdecl.} =
|
||||
## *
|
||||
## @brief Sets the \ref AccountUid for the \ref NotifAlarmSetting, see NotifAlarmSetting::uid.
|
||||
## @param alarm_setting \ref NotifAlarmSetting
|
||||
|
|
|
|||
|
|
@ -313,6 +313,5 @@ proc pdmqryGetRecentlyPlayedApplicationUpdateEvent*(outEvent: ptr Event): Result
|
|||
## @param[in] timestamp Input timestamp.
|
||||
##
|
||||
|
||||
proc pdmPlayTimestampToPosix*(timestamp: U32): U64 {.inline, cdecl,
|
||||
importc: "pdmPlayTimestampToPosix".} =
|
||||
proc pdmPlayTimestampToPosix*(timestamp: U32): U64 {.inline, cdecl.} =
|
||||
return (cast[U64](timestamp)) * 60 + 946598400
|
||||
|
|
|
|||
|
|
@ -15,22 +15,19 @@ type
|
|||
SmServiceName* {.bycopy.} = object
|
||||
name*: array[8, char]
|
||||
|
||||
proc smServiceNameToU64*(name: SmServiceName): U64 {.inline, cdecl,
|
||||
importc: "smServiceNameToU64".} =
|
||||
proc smServiceNameToU64*(name: SmServiceName): U64 {.inline, cdecl.} =
|
||||
## / Converts a service name into a 64-bit integer.
|
||||
var ret: U64 = 0
|
||||
copyMem(addr(ret), addr(name), sizeof((U64)))
|
||||
return ret
|
||||
|
||||
proc smServiceNameFromU64*(name: U64): SmServiceName {.inline, cdecl,
|
||||
importc: "smServiceNameFromU64".} =
|
||||
proc smServiceNameFromU64*(name: U64): SmServiceName {.inline, cdecl.} =
|
||||
## / Converts a 64-bit integer into a service name.
|
||||
var ret: SmServiceName = SmServiceName()
|
||||
copyMem(addr(ret), addr(name), sizeof((SmServiceName)))
|
||||
return ret
|
||||
|
||||
proc smServiceNamesAreEqual*(a: SmServiceName; b: SmServiceName): bool {.inline, cdecl,
|
||||
importc: "smServiceNamesAreEqual".} =
|
||||
proc smServiceNamesAreEqual*(a: SmServiceName; b: SmServiceName): bool {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Checks whether two service names are equal.
|
||||
## @param[in] a First name.
|
||||
|
|
@ -39,8 +36,7 @@ proc smServiceNamesAreEqual*(a: SmServiceName; b: SmServiceName): bool {.inline,
|
|||
##
|
||||
return smServiceNameToU64(a) == smServiceNameToU64(b)
|
||||
|
||||
proc smEncodeName*(name: cstring): SmServiceName {.inline, cdecl,
|
||||
importc: "smEncodeName".} =
|
||||
proc smEncodeName*(name: cstring): SmServiceName {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Encodes a service name string as a \ref SmServiceName structure.
|
||||
## @param[in] name Name of the service.
|
||||
|
|
@ -99,8 +95,7 @@ proc smGetServiceOriginal*(handleOut: ptr Handle; name: SmServiceName): Result {
|
|||
## @return Result code.
|
||||
##
|
||||
|
||||
proc smGetService*(serviceOut: ptr Service; name: cstring): Result {.inline, cdecl,
|
||||
importc: "smGetService".} =
|
||||
proc smGetService*(serviceOut: ptr Service; name: cstring): Result {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Requests a service from SM.
|
||||
## @param[out] service_out Service structure which will be filled in.
|
||||
|
|
|
|||
|
|
@ -183,14 +183,12 @@ proc usbHsAcquireUsbIf*(s: ptr UsbHsClientIfSession; `interface`: ptr UsbHsInter
|
|||
proc usbHsIfClose*(s: ptr UsbHsClientIfSession) {.cdecl, importc: "usbHsIfClose".}
|
||||
## / Returns whether the specified interface session was initialized.
|
||||
|
||||
proc usbHsIfIsActive*(s: ptr UsbHsClientIfSession): bool {.inline, cdecl,
|
||||
importc: "usbHsIfIsActive".} =
|
||||
proc usbHsIfIsActive*(s: ptr UsbHsClientIfSession): bool {.inline, cdecl.} =
|
||||
return serviceIsActive(addr(s.s))
|
||||
|
||||
## / Returns the ID which can be used for comparing with the ID in the output interfaces from \ref usbHsQueryAcquiredInterfaces.
|
||||
|
||||
proc usbHsIfGetID*(s: ptr UsbHsClientIfSession): S32 {.inline, cdecl,
|
||||
importc: "usbHsIfGetID".} =
|
||||
proc usbHsIfGetID*(s: ptr UsbHsClientIfSession): S32 {.inline, cdecl.} =
|
||||
return s.id
|
||||
|
||||
## *
|
||||
|
|
|
|||
|
|
@ -95,8 +95,7 @@ proc viOpenDisplay*(displayName: cstring; display: ptr ViDisplay): Result {.cdec
|
|||
importc: "viOpenDisplay".}
|
||||
proc viCloseDisplay*(display: ptr ViDisplay): Result {.cdecl,
|
||||
importc: "viCloseDisplay".}
|
||||
proc viOpenDefaultDisplay*(display: ptr ViDisplay): Result {.inline, cdecl,
|
||||
importc: "viOpenDefaultDisplay".} =
|
||||
proc viOpenDefaultDisplay*(display: ptr ViDisplay): Result {.inline, cdecl.} =
|
||||
return viOpenDisplay("Default", display)
|
||||
|
||||
proc viGetDisplayResolution*(display: ptr ViDisplay; width: ptr S32; height: ptr S32): Result {.
|
||||
|
|
|
|||
|
|
@ -152,8 +152,7 @@ proc cmifMakeControlRequest*(base: pointer; requestId: U32; size: U32): pointer
|
|||
hdr.token = 0
|
||||
return hdr + 1
|
||||
|
||||
proc cmifMakeCloseRequest*(base: pointer; objectId: U32) {.inline, cdecl,
|
||||
importc: "cmifMakeCloseRequest".} =
|
||||
proc cmifMakeCloseRequest*(base: pointer; objectId: U32) {.inline, cdecl.} =
|
||||
var base = base
|
||||
if objectId.bool:
|
||||
var hipc = hipcMakeRequestInline(base,
|
||||
|
|
@ -170,32 +169,29 @@ proc cmifMakeCloseRequest*(base: pointer; objectId: U32) {.inline, cdecl,
|
|||
);
|
||||
|
||||
proc cmifRequestInBuffer*(req: ptr CmifRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "cmifRequestInBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
req.hipc.sendBuffers += 1
|
||||
req.hipc.sendBuffers[] = hipcMakeBuffer(buffer, size, mode)
|
||||
|
||||
proc cmifRequestOutBuffer*(req: ptr CmifRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "cmifRequestOutBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
req.hipc.recvBuffers += 1
|
||||
req.hipc.recvBuffers[] = hipcMakeBuffer(buffer, size, mode)
|
||||
|
||||
proc cmifRequestInOutBuffer*(req: ptr CmifRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "cmifRequestInOutBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
req.hipc.exchBuffers += 1
|
||||
req.hipc.exchBuffers[] = hipcMakeBuffer(buffer, size, mode)
|
||||
|
||||
proc cmifRequestInPointer*(req: ptr CmifRequest; buffer: pointer; size: csize_t) {.
|
||||
inline, cdecl, importc: "cmifRequestInPointer".} =
|
||||
inline, cdecl.} =
|
||||
req.hipc.sendStatics += 1
|
||||
req.hipc.sendStatics[] = hipcMakeSendStatic(buffer, size, req.curInPtrId.U8)
|
||||
req.curInPtrId += 1
|
||||
dec(req.serverPointerSize, size)
|
||||
|
||||
proc cmifRequestOutFixedPointer*(req: ptr CmifRequest; buffer: pointer; size: csize_t) {.
|
||||
inline, cdecl, importc: "cmifRequestOutFixedPointer".} =
|
||||
inline, cdecl.} =
|
||||
req.hipc.recvList += 1
|
||||
req.hipc.recvList[] = hipcMakeRecvStatic(buffer, size)
|
||||
dec(req.serverPointerSize, size)
|
||||
|
|
@ -207,8 +203,7 @@ proc cmifRequestOutPointer*(req: ptr CmifRequest; buffer: pointer; size: csize_t
|
|||
req.outPointerSizes[] = size.U16
|
||||
|
||||
proc cmifRequestInAutoBuffer*(req: ptr CmifRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "cmifRequestInAutoBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
if req.serverPointerSize.bool and size <= req.serverPointerSize:
|
||||
cmifRequestInPointer(req, buffer, size)
|
||||
cmifRequestInBuffer(req, nil, 0, mode)
|
||||
|
|
@ -217,8 +212,7 @@ proc cmifRequestInAutoBuffer*(req: ptr CmifRequest; buffer: pointer; size: csize
|
|||
cmifRequestInBuffer(req, buffer, size, mode)
|
||||
|
||||
proc cmifRequestOutAutoBuffer*(req: ptr CmifRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "cmifRequestOutAutoBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
if req.serverPointerSize.bool and size <= req.serverPointerSize:
|
||||
cmifRequestOutPointer(req, buffer, size)
|
||||
cmifRequestOutBuffer(req, nil, 0, mode)
|
||||
|
|
@ -226,18 +220,16 @@ proc cmifRequestOutAutoBuffer*(req: ptr CmifRequest; buffer: pointer; size: csiz
|
|||
cmifRequestOutPointer(req, nil, 0)
|
||||
cmifRequestOutBuffer(req, buffer, size, mode)
|
||||
|
||||
proc cmifRequestObject*(req: ptr CmifRequest; objectId: U32) {.inline, cdecl,
|
||||
importc: "cmifRequestObject".} =
|
||||
proc cmifRequestObject*(req: ptr CmifRequest; objectId: U32) {.inline, cdecl.} =
|
||||
req.objects += 1
|
||||
req.objects[] = objectId
|
||||
|
||||
proc cmifRequestHandle*(req: ptr CmifRequest; handle: Handle) {.inline, cdecl,
|
||||
importc: "cmifRequestHandle".} =
|
||||
proc cmifRequestHandle*(req: ptr CmifRequest; handle: Handle) {.inline, cdecl.} =
|
||||
req.hipc.copyHandles += 1
|
||||
req.hipc.copyHandles[] = handle
|
||||
|
||||
proc cmifParseResponse*(res: ptr CmifResponse; base: pointer; isDomain: bool; size: U32): Result {.
|
||||
inline, cdecl, importc: "cmifParseResponse".} =
|
||||
inline, cdecl.} =
|
||||
var base = base
|
||||
var hipc: HipcResponse = hipcParseResponse(base)
|
||||
var start: pointer = cmifGetAlignedDataStart(hipc.dataWords, base)
|
||||
|
|
@ -258,23 +250,20 @@ proc cmifParseResponse*(res: ptr CmifResponse; base: pointer; isDomain: bool; si
|
|||
## Error: expected ';'!!!
|
||||
return 0
|
||||
|
||||
proc cmifResponseGetObject*(res: ptr CmifResponse): U32 {.inline, cdecl,
|
||||
importc: "cmifResponseGetObject".} =
|
||||
proc cmifResponseGetObject*(res: ptr CmifResponse): U32 {.inline, cdecl.} =
|
||||
res.objects += 1
|
||||
return res.objects[]
|
||||
|
||||
proc cmifResponseGetCopyHandle*(res: ptr CmifResponse): Handle {.inline, cdecl,
|
||||
importc: "cmifResponseGetCopyHandle".} =
|
||||
proc cmifResponseGetCopyHandle*(res: ptr CmifResponse): Handle {.inline, cdecl.} =
|
||||
res.copyHandles += 1
|
||||
return res.copyHandles[]
|
||||
|
||||
proc cmifResponseGetMoveHandle*(res: ptr CmifResponse): Handle {.inline, cdecl,
|
||||
importc: "cmifResponseGetMoveHandle".} =
|
||||
proc cmifResponseGetMoveHandle*(res: ptr CmifResponse): Handle {.inline, cdecl.} =
|
||||
res.moveHandles += 1
|
||||
return res.moveHandles[]
|
||||
|
||||
proc cmifConvertCurrentObjectToDomain*(h: Handle; outObjectId: ptr U32): Result {.
|
||||
inline, cdecl, importc: "cmifConvertCurrentObjectToDomain".} =
|
||||
inline, cdecl.} =
|
||||
var p = armGetTls()
|
||||
discard cmifMakeControlRequest(p, 0, 0)
|
||||
var rc: Result = svcSendSyncRequest(h)
|
||||
|
|
@ -287,7 +276,7 @@ proc cmifConvertCurrentObjectToDomain*(h: Handle; outObjectId: ptr U32): Result
|
|||
return rc
|
||||
|
||||
proc cmifCopyFromCurrentDomain*(h: Handle; objectId: U32; outH: ptr Handle): Result {.
|
||||
inline, cdecl, importc: "cmifCopyFromCurrentDomain".} =
|
||||
inline, cdecl.} =
|
||||
var p = armGetTls()
|
||||
var raw: pointer = cmifMakeControlRequest(p, 1, sizeof((U32)).U32)
|
||||
cast[ptr U32](raw)[] = objectId
|
||||
|
|
@ -300,8 +289,7 @@ proc cmifCopyFromCurrentDomain*(h: Handle; objectId: U32; outH: ptr Handle): Res
|
|||
outH[] = resp.moveHandles[0]
|
||||
return rc
|
||||
|
||||
proc cmifCloneCurrentObject*(h: Handle; outH: ptr Handle): Result {.inline, cdecl,
|
||||
importc: "cmifCloneCurrentObject".} =
|
||||
proc cmifCloneCurrentObject*(h: Handle; outH: ptr Handle): Result {.inline, cdecl.} =
|
||||
discard cmifMakeControlRequest(armGetTls(), 2, 0)
|
||||
var rc: Result = svcSendSyncRequest(h)
|
||||
if r_Succeeded(rc):
|
||||
|
|
@ -311,8 +299,7 @@ proc cmifCloneCurrentObject*(h: Handle; outH: ptr Handle): Result {.inline, cdec
|
|||
outH[] = resp.moveHandles[0]
|
||||
return rc
|
||||
|
||||
proc cmifQueryPointerBufferSize*(h: Handle; outSize: ptr U16): Result {.inline, cdecl,
|
||||
importc: "cmifQueryPointerBufferSize".} =
|
||||
proc cmifQueryPointerBufferSize*(h: Handle; outSize: ptr U16): Result {.inline, cdecl.} =
|
||||
discard cmifMakeControlRequest(armGetTls(), 3, 0)
|
||||
var rc: Result = svcSendSyncRequest(h)
|
||||
if r_Succeeded(rc):
|
||||
|
|
@ -322,8 +309,7 @@ proc cmifQueryPointerBufferSize*(h: Handle; outSize: ptr U16): Result {.inline,
|
|||
outSize[] = cast[ptr U16](resp.data)[]
|
||||
return rc
|
||||
|
||||
proc cmifCloneCurrentObjectEx*(h: Handle; tag: U32; outH: ptr Handle): Result {.inline,
|
||||
cdecl, importc: "cmifCloneCurrentObjectEx".} =
|
||||
proc cmifCloneCurrentObjectEx*(h: Handle; tag: U32; outH: ptr Handle): Result {.inline, cdecl.} =
|
||||
var raw: pointer = cmifMakeControlRequest(armGetTls(), 4, sizeof((U32)).U32)
|
||||
cast[ptr U32](raw)[] = tag
|
||||
var rc: Result = svcSendSyncRequest(h)
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ type
|
|||
|
||||
|
||||
proc hipcMakeSendStatic*(buffer: pointer; size: csize_t; index: U8): HipcStaticDescriptor {.
|
||||
inline, cdecl, importc: "hipcMakeSendStatic".} =
|
||||
inline, cdecl.} =
|
||||
return HipcStaticDescriptor(
|
||||
index: index,
|
||||
address_high: (U32)(cast[uintptr_t](buffer) shr 36),
|
||||
|
|
@ -106,7 +106,7 @@ proc hipcMakeSendStatic*(buffer: pointer; size: csize_t; index: U8): HipcStaticD
|
|||
)
|
||||
|
||||
proc hipcMakeBuffer*(buffer: pointer; size: csize_t; mode: HipcBufferMode): HipcBufferDescriptor {.
|
||||
inline, cdecl, importc: "hipcMakeBuffer".} =
|
||||
inline, cdecl.} =
|
||||
return HipcBufferDescriptor(
|
||||
size_low: (U32)size,
|
||||
address_low: (U32)cast[uintptr_t](buffer),
|
||||
|
|
@ -116,36 +116,30 @@ proc hipcMakeBuffer*(buffer: pointer; size: csize_t; mode: HipcBufferMode): Hipc
|
|||
address_mid: (U32)(cast[uintptr_t](buffer) shr 32),
|
||||
)
|
||||
|
||||
proc hipcMakeRecvStatic*(buffer: pointer; size: csize_t): HipcRecvListEntry {.inline,
|
||||
cdecl, importc: "hipcMakeRecvStatic".} =
|
||||
proc hipcMakeRecvStatic*(buffer: pointer; size: csize_t): HipcRecvListEntry {.inline, cdecl.} =
|
||||
return HipcRecvListEntry(
|
||||
address_low: (U32)(cast[uintptr_t](buffer)),
|
||||
address_high: (U32)(cast[uintptr_t](buffer) shr 32),
|
||||
size: (U32)size,
|
||||
)
|
||||
|
||||
proc hipcGetStaticAddress*(desc: ptr HipcStaticDescriptor): pointer {.inline, cdecl,
|
||||
importc: "hipcGetStaticAddress".} =
|
||||
proc hipcGetStaticAddress*(desc: ptr HipcStaticDescriptor): pointer {.inline, cdecl.} =
|
||||
return cast[pointer]((desc.addressLow or
|
||||
(cast[uintptrT](desc.addressMid) shl 32) or
|
||||
(cast[uintptrT](desc.addressHigh) shl 36)))
|
||||
|
||||
proc hipcGetStaticSize*(desc: ptr HipcStaticDescriptor): csize_t {.inline, cdecl,
|
||||
importc: "hipcGetStaticSize".} =
|
||||
proc hipcGetStaticSize*(desc: ptr HipcStaticDescriptor): csize_t {.inline, cdecl.} =
|
||||
return desc.size
|
||||
|
||||
proc hipcGetBufferAddress*(desc: ptr HipcBufferDescriptor): pointer {.inline, cdecl,
|
||||
importc: "hipcGetBufferAddress".} =
|
||||
proc hipcGetBufferAddress*(desc: ptr HipcBufferDescriptor): pointer {.inline, cdecl.} =
|
||||
return cast[pointer]((desc.addressLow or
|
||||
(cast[uintptrT](desc.addressMid) shl 32) or
|
||||
(cast[uintptrT](desc.addressHigh) shl 36)))
|
||||
|
||||
proc hipcGetBufferSize*(desc: ptr HipcBufferDescriptor): csize_t {.inline, cdecl,
|
||||
importc: "hipcGetBufferSize".} =
|
||||
proc hipcGetBufferSize*(desc: ptr HipcBufferDescriptor): csize_t {.inline, cdecl.} =
|
||||
return desc.sizeLow or (cast[csize_t](desc.sizeHigh) shl 32)
|
||||
|
||||
proc hipcCalcRequestLayout*(meta: HipcMetadata; base: pointer): HipcRequest {.inline,
|
||||
cdecl, importc: "hipcCalcRequestLayout".} =
|
||||
proc hipcCalcRequestLayout*(meta: HipcMetadata; base: pointer): HipcRequest {.inline, cdecl.} =
|
||||
var base = base
|
||||
## Copy handles
|
||||
var copyHandles: ptr Handle = nil
|
||||
|
|
@ -192,8 +186,7 @@ proc hipcCalcRequestLayout*(meta: HipcMetadata; base: pointer): HipcRequest {.in
|
|||
)
|
||||
|
||||
|
||||
proc hipcMakeRequest*(base: pointer; meta: HipcMetadata): HipcRequest {.inline, cdecl,
|
||||
importc: "hipcMakeRequest".} =
|
||||
proc hipcMakeRequest*(base: pointer; meta: HipcMetadata): HipcRequest {.inline, cdecl.} =
|
||||
## Write message header
|
||||
var base = base
|
||||
var hasSpecialHeader = (meta.sendPid or meta.numCopyHandles or
|
||||
|
|
|
|||
|
|
@ -187,12 +187,9 @@ proc hipcCalcRequestLayout*(meta: HipcMetadata; base: pointer): HipcRequest {.in
|
|||
proc hipcMakeRequest*(base: pointer; meta: HipcMetadata): HipcRequest {.inline, cdecl.} =
|
||||
## Write message header
|
||||
var base = base
|
||||
var hasSpecialHeader: bool = meta.sendPid or meta.numCopyHandles or
|
||||
meta.numMoveHandles
|
||||
var hasSpecialHeader: bool = (meta.sendPid or meta.numCopyHandles or meta.numMoveHandles).bool
|
||||
var hdr: ptr HipcHeader = cast[ptr HipcHeader](base)
|
||||
base = hdr + 1
|
||||
## !!!Ignored construct: * hdr = ( HipcHeader ) { . type = meta . type , . num_send_statics = meta . num_send_statics , . num_send_buffers = meta . num_send_buffers , . num_recv_buffers = meta . num_recv_buffers , . num_exch_buffers = meta . num_exch_buffers , . num_data_words = meta . num_data_words , . recv_static_mode = meta . num_recv_statics ? ( meta . num_recv_statics != HIPC_AUTO_RECV_STATIC ? 2u + meta . num_recv_statics : 2u ) : 0u , . padding = 0 , . recv_list_offset = 0 , . has_special_header = has_special_header , } ;
|
||||
## Error: expected ';'!!!
|
||||
hdr[] = HipcHeader(
|
||||
type: meta.type,
|
||||
num_send_statics: meta.num_send_statics,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ type
|
|||
## @return true if initialized.
|
||||
##
|
||||
|
||||
proc serviceIsActive*(s: ptr Service): bool {.inline, cdecl, importc: "serviceIsActive".} =
|
||||
proc serviceIsActive*(s: ptr Service): bool {.inline, cdecl.} =
|
||||
return s.session != Invalid_Handle
|
||||
|
||||
## *
|
||||
|
|
@ -88,8 +88,7 @@ proc serviceIsActive*(s: ptr Service): bool {.inline, cdecl, importc: "serviceIs
|
|||
## @return true if overriden.
|
||||
##
|
||||
|
||||
proc serviceIsOverride*(s: ptr Service): bool {.inline, cdecl,
|
||||
importc: "serviceIsOverride".} =
|
||||
proc serviceIsOverride*(s: ptr Service): bool {.inline, cdecl.} =
|
||||
return serviceIsActive(s) and not s.ownHandle.bool and not s.objectId.bool
|
||||
|
||||
## *
|
||||
|
|
@ -98,7 +97,7 @@ proc serviceIsOverride*(s: ptr Service): bool {.inline, cdecl,
|
|||
## @return true if a domain.
|
||||
##
|
||||
|
||||
proc serviceIsDomain*(s: ptr Service): bool {.inline, cdecl, importc: "serviceIsDomain".} =
|
||||
proc serviceIsDomain*(s: ptr Service): bool {.inline, cdecl.} =
|
||||
return serviceIsActive(s) and s.ownHandle.bool and s.objectId.bool
|
||||
|
||||
## *
|
||||
|
|
@ -107,8 +106,7 @@ proc serviceIsDomain*(s: ptr Service): bool {.inline, cdecl, importc: "serviceIs
|
|||
## @return true if a domain subservice.
|
||||
##
|
||||
|
||||
proc serviceIsDomainSubservice*(s: ptr Service): bool {.inline, cdecl,
|
||||
importc: "serviceIsDomainSubservice".} =
|
||||
proc serviceIsDomainSubservice*(s: ptr Service): bool {.inline, cdecl.} =
|
||||
return serviceIsActive(s) and not s.ownHandle.bool and s.objectId.bool
|
||||
|
||||
## *
|
||||
|
|
@ -117,8 +115,7 @@ proc serviceIsDomainSubservice*(s: ptr Service): bool {.inline, cdecl,
|
|||
## @return The object ID.
|
||||
##
|
||||
|
||||
proc serviceGetObjectId*(s: ptr Service): U32 {.inline, cdecl,
|
||||
importc: "serviceGetObjectId".} =
|
||||
proc serviceGetObjectId*(s: ptr Service): U32 {.inline, cdecl.} =
|
||||
return s.objectId
|
||||
|
||||
## *
|
||||
|
|
@ -127,7 +124,7 @@ proc serviceGetObjectId*(s: ptr Service): U32 {.inline, cdecl,
|
|||
## @param[in] h IPC session handle.
|
||||
##
|
||||
|
||||
proc serviceCreate*(s: ptr Service; h: Handle) {.inline, cdecl, importc: "serviceCreate".} =
|
||||
proc serviceCreate*(s: ptr Service; h: Handle) {.inline, cdecl.} =
|
||||
s.session = h
|
||||
s.ownHandle = 1
|
||||
s.objectId = 0
|
||||
|
|
@ -142,7 +139,7 @@ proc serviceCreate*(s: ptr Service; h: Handle) {.inline, cdecl, importc: "servic
|
|||
##
|
||||
|
||||
proc serviceCreateNonDomainSubservice*(s: ptr Service; parent: ptr Service; h: Handle) {.
|
||||
inline, cdecl, importc: "serviceCreateNonDomainSubservice".} =
|
||||
inline, cdecl.} =
|
||||
if h != Invalid_Handle:
|
||||
s.session = h
|
||||
s.ownHandle = 1
|
||||
|
|
@ -159,7 +156,7 @@ proc serviceCreateNonDomainSubservice*(s: ptr Service; parent: ptr Service; h: H
|
|||
##
|
||||
|
||||
proc serviceCreateDomainSubservice*(s: ptr Service; parent: ptr Service; objectId: U32) {.
|
||||
inline, cdecl, importc: "serviceCreateDomainSubservice".} =
|
||||
inline, cdecl.} =
|
||||
if objectId != 0:
|
||||
s.session = parent.session
|
||||
s.ownHandle = 0
|
||||
|
|
@ -239,8 +236,7 @@ proc serviceCloneEx*(s: ptr Service; tag: U32; outS: ptr Service): Result {.inli
|
|||
## @return Result code.
|
||||
##
|
||||
|
||||
proc serviceConvertToDomain*(s: ptr Service): Result {.inline, cdecl,
|
||||
importc: "serviceConvertToDomain".} =
|
||||
proc serviceConvertToDomain*(s: ptr Service): Result {.inline, cdecl.} =
|
||||
if not s.ownHandle.bool:
|
||||
## For overridden services, create a clone first.
|
||||
var rc: Result = cmifCloneCurrentObjectEx(s.session, 0, addr(s.session))
|
||||
|
|
@ -250,7 +246,7 @@ proc serviceConvertToDomain*(s: ptr Service): Result {.inline, cdecl,
|
|||
return cmifConvertCurrentObjectToDomain(s.session, addr(s.objectId))
|
||||
|
||||
proc serviceRequestFormatProcessBuffer*(fmt: ptr CmifRequestFormat; attr: U32) {.
|
||||
inline, cdecl, importc: "_serviceRequestFormatProcessBuffer".} =
|
||||
inline, cdecl.} =
|
||||
if attr == 0:
|
||||
return
|
||||
|
||||
|
|
@ -278,7 +274,7 @@ proc serviceRequestFormatProcessBuffer*(fmt: ptr CmifRequestFormat; attr: U32) {
|
|||
inc(fmt.numOutBuffers)
|
||||
|
||||
proc serviceRequestProcessBuffer*(req: ptr CmifRequest; buf: ptr SfBuffer; attr: U32) {.
|
||||
inline, cdecl, importc: "_serviceRequestProcessBuffer".} =
|
||||
inline, cdecl.} =
|
||||
if attr == 0:
|
||||
return
|
||||
let isIn: bool = (attr and SfBufferAttrIn).bool
|
||||
|
|
@ -318,7 +314,7 @@ proc serviceMakeRequest*(s: ptr Service; requestId: U32; context: U32; dataSize:
|
|||
sendPid: bool; bufferAttrs: SfBufferAttrs;
|
||||
buffers: openArray[SfBuffer]; numObjects: U32;
|
||||
objects: openArray[ptr Service]; numHandles: U32; handles: openArray[Handle]): pointer {.
|
||||
inline, cdecl, importc: "serviceMakeRequest".} =
|
||||
inline, cdecl.} =
|
||||
when defined(nx_Service_Assume_Non_Domain):
|
||||
if s.objectId:
|
||||
builtinUnreachable()
|
||||
|
|
|
|||
|
|
@ -21,6 +21,5 @@ proc sessionmgrAttachClient*(mgr: ptr SessionMgr): cint {.cdecl,
|
|||
importc: "sessionmgrAttachClient".}
|
||||
proc sessionmgrDetachClient*(mgr: ptr SessionMgr; slot: cint) {.cdecl,
|
||||
importc: "sessionmgrDetachClient".}
|
||||
proc sessionmgrGetClientSession*(mgr: ptr SessionMgr; slot: cint): Handle {.inline,
|
||||
cdecl, importc: "sessionmgrGetClientSession".} =
|
||||
proc sessionmgrGetClientSession*(mgr: ptr SessionMgr; slot: cint): Handle {.inline, cdecl.} =
|
||||
return mgr.sessions[slot]
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ type
|
|||
sendPid*: U32
|
||||
|
||||
|
||||
proc tipcCreate*(s: ptr TipcService; h: Handle) {.inline, cdecl, importc: "tipcCreate".} =
|
||||
proc tipcCreate*(s: ptr TipcService; h: Handle) {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Creates a tipc service object from an IPC session handle.
|
||||
## @param[out] s TIPC service object.
|
||||
|
|
@ -49,7 +49,7 @@ proc tipcCreate*(s: ptr TipcService; h: Handle) {.inline, cdecl, importc: "tipcC
|
|||
##
|
||||
s.session = h
|
||||
|
||||
proc tipcClose*(s: ptr TipcService) {.inline, cdecl, importc: "tipcClose".} =
|
||||
proc tipcClose*(s: ptr TipcService) {.inline, cdecl.} =
|
||||
## *
|
||||
## @brief Closes a tipc service.
|
||||
## @param[in] s TIPC service object.
|
||||
|
|
@ -60,30 +60,25 @@ proc tipcClose*(s: ptr TipcService) {.inline, cdecl, importc: "tipcClose".} =
|
|||
s[] = TipcService()
|
||||
|
||||
proc tipcRequestInBuffer*(req: ptr HipcRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "tipcRequestInBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
req.sendBuffers += 1
|
||||
req.sendBuffers[] = hipcMakeBuffer(buffer, size, mode)
|
||||
|
||||
proc tipcRequestOutBuffer*(req: ptr HipcRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "tipcRequestOutBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
req.recvBuffers += 1
|
||||
req.recvBuffers[] = hipcMakeBuffer(buffer, size, mode)
|
||||
|
||||
proc tipcRequestInOutBuffer*(req: ptr HipcRequest; buffer: pointer; size: csize_t;
|
||||
mode: HipcBufferMode) {.inline, cdecl,
|
||||
importc: "tipcRequestInOutBuffer".} =
|
||||
mode: HipcBufferMode) {.inline, cdecl.} =
|
||||
req.exchBuffers += 1
|
||||
req.exchBuffers[] = hipcMakeBuffer(buffer, size, mode)
|
||||
|
||||
proc tipcRequestHandle*(req: ptr HipcRequest; handle: Handle) {.inline, cdecl,
|
||||
importc: "tipcRequestHandle".} =
|
||||
proc tipcRequestHandle*(req: ptr HipcRequest; handle: Handle) {.inline, cdecl.} =
|
||||
req.copyHandles += 1
|
||||
req.copyHandles[] = handle
|
||||
|
||||
proc tipcRequestFormatProcessBuffer*(fmt: ptr TipcRequestFormat; attr: U32) {.inline,
|
||||
cdecl, importc: "_tipcRequestFormatProcessBuffer".} =
|
||||
proc tipcRequestFormatProcessBuffer*(fmt: ptr TipcRequestFormat; attr: U32) {.inline, cdecl.} =
|
||||
if not attr.bool:
|
||||
return
|
||||
let isIn: bool = (attr and SfBufferAttrIn) != 0
|
||||
|
|
@ -97,7 +92,7 @@ proc tipcRequestFormatProcessBuffer*(fmt: ptr TipcRequestFormat; attr: U32) {.in
|
|||
inc(fmt.numOutBuffers)
|
||||
|
||||
proc tipcRequestProcessBuffer*(req: ptr HipcRequest; buf: ptr SfBuffer; attr: U32) {.
|
||||
inline, cdecl, importc: "_tipcRequestProcessBuffer".} =
|
||||
inline, cdecl.} =
|
||||
if not attr.bool:
|
||||
return
|
||||
let isIn: bool = (attr and SfBufferAttrIn).bool
|
||||
|
|
@ -157,13 +152,11 @@ proc tipcMakeRequest*(requestId: U32; dataSize: U32; sendPid: bool;
|
|||
tipcRequestProcessBuffer(addr(req), addr(buffers[7]), bufferAttrs.attr7)
|
||||
return req.dataWords
|
||||
|
||||
proc tipcResponseGetCopyHandle*(res: ptr HipcResponse): Handle {.inline, cdecl,
|
||||
importc: "tipcResponseGetCopyHandle".} =
|
||||
proc tipcResponseGetCopyHandle*(res: ptr HipcResponse): Handle {.inline, cdecl.} =
|
||||
res.copyHandles += 1
|
||||
return res.copyHandles[]
|
||||
|
||||
proc tipcResponseGetMoveHandle*(res: ptr HipcResponse): Handle {.inline, cdecl,
|
||||
importc: "tipcResponseGetMoveHandle".} =
|
||||
proc tipcResponseGetMoveHandle*(res: ptr HipcResponse): Handle {.inline, cdecl.} =
|
||||
res.moveHandles += 1
|
||||
return res.moveHandles[]
|
||||
|
||||
|
|
@ -184,7 +177,7 @@ proc tipcResponseGetHandle*(res: ptr HipcResponse; ty: SfOutHandleAttr;
|
|||
proc tipcParseResponse*(outSize: U32; outData: ptr pointer; numOutObjects: U32;
|
||||
outObjects: ptr TipcService;
|
||||
outHandleAttrs: SfOutHandleAttrs; outHandles: ptr Handle): Result {.
|
||||
inline, cdecl, importc: "tipcParseResponse".} =
|
||||
inline, cdecl.} =
|
||||
var res: HipcResponse = hipcParseResponse(armGetTls())
|
||||
res.dataWords += 1
|
||||
var rc: Result = res.dataWords[]
|
||||
|
|
@ -208,8 +201,7 @@ proc tipcParseResponse*(outSize: U32; outData: ptr pointer; numOutObjects: U32;
|
|||
|
||||
proc tipcDispatchImpl*(s: ptr TipcService; requestId: U32; inData: pointer;
|
||||
inDataSize: U32; outData: pointer; outDataSize: U32;
|
||||
disp: TipcDispatchParams): Result {.inline, cdecl,
|
||||
importc: "tipcDispatchImpl".} =
|
||||
disp: TipcDispatchParams): Result {.inline, cdecl.} =
|
||||
var `in`: pointer = tipcMakeRequest(requestId, inDataSize, disp.inSendPid,
|
||||
disp.bufferAttrs, disp.buffers,
|
||||
disp.inNumHandles, disp.inHandles)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue