示例#1
0
文件: IClient.cs 项目: mailwl/Ryujinx
        // Initialize(nn::socket::BsdBufferConfig config, u64 pid, u64 transferMemorySize, KObject<copy, transfer_memory>, pid) -> u32 bsd_errno
        public ResultCode RegisterClient(ServiceCtx context)
        {
            _context = BsdContext.GetOrRegister(context.Request.HandleDesc.PId);

            /*
             * typedef struct  {
             *  u32 version;                // Observed 1 on 2.0 LibAppletWeb, 2 on 3.0.
             *  u32 tcp_tx_buf_size;        // Size of the TCP transfer (send) buffer (initial or fixed).
             *  u32 tcp_rx_buf_size;        // Size of the TCP recieve buffer (initial or fixed).
             *  u32 tcp_tx_buf_max_size;    // Maximum size of the TCP transfer (send) buffer. If it is 0, the size of the buffer is fixed to its initial value.
             *  u32 tcp_rx_buf_max_size;    // Maximum size of the TCP receive buffer. If it is 0, the size of the buffer is fixed to its initial value.
             *  u32 udp_tx_buf_size;        // Size of the UDP transfer (send) buffer (typically 0x2400 bytes).
             *  u32 udp_rx_buf_size;        // Size of the UDP receive buffer (typically 0xA500 bytes).
             *  u32 sb_efficiency;          // Number of buffers for each socket (standard values range from 1 to 8).
             * } BsdBufferConfig;
             */

            // bsd_error
            context.ResponseData.Write(0);

            Logger.Stub?.PrintStub(LogClass.ServiceBsd);

            // Close transfer memory immediately as we don't use it.
            context.Device.System.KernelContext.Syscall.CloseHandle(context.Request.HandleDesc.ToCopy[0]);

            return(ResultCode.Success);
        }
示例#2
0
        public static BsdContext GetOrRegister(long processId)
        {
            BsdContext context = GetContext(processId);

            if (context == null)
            {
                context = new BsdContext();

                _registry.TryAdd(processId, context);
            }

            return(context);
        }