示例#1
0
        public virtual int sceNetAdhocMatchingCreate(int mode, int maxPeers, int port, int bufSize, int helloDelay, int pingDelay, int initCount, int msgDelay, TPointer callback)
        {
            checkInitialized();

            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceNetAdhocMatchingCreate mode={0}", getModeName(mode)));
            }

            MatchingObject matchingObject = NetworkAdapter.createMatchingObject();

            matchingObject.Mode       = mode;
            matchingObject.MaxPeers   = maxPeers;
            matchingObject.Port       = port;
            matchingObject.BufSize    = bufSize;
            matchingObject.HelloDelay = helloDelay;
            matchingObject.PingDelay  = pingDelay;
            matchingObject.InitCount  = initCount;
            matchingObject.MsgDelay   = msgDelay;
            matchingObject.Callback   = callback.Address;
            matchingObject.create();
            matchingObjects[matchingObject.Id] = matchingObject;

            return(matchingObject.Id);
        }
示例#2
0
        public virtual int sceNetAdhocMatchingGetMembers(int matchingId, TPointer32 sizeAddr, TPointer buf)
        {
            const int matchingMemberSize = 12;

            MatchingObject           matchingObject = matchingObjects[matchingId];
            IList <pspNetMacAddress> members        = matchingObject.Members;

            int size = sizeAddr.getValue();

            sizeAddr.setValue(matchingMemberSize * members.Count);
            //if (log.DebugEnabled)
            {
                Console.WriteLine(string.Format("sceNetAdhocMatchingGetMembers returning size={0:D}", sizeAddr.getValue()));
            }

            if (buf.NotNull)
            {
                int offset = 0;
                foreach (pspNetMacAddress member in members)
                {
                    // Check if enough space available to write the next structure
                    if (offset + matchingMemberSize > size || member == null)
                    {
                        break;
                    }

                    //if (log.DebugEnabled)
                    {
                        Console.WriteLine(string.Format("sceNetAdhocMatchingGetMembers returning {0} at 0x{1:X8}", member, buf.Address + offset));
                    }

                    /// <summary>
                    /// Pointer to next Member structure in list: will be written later </summary>
                    offset += 4;

                    /// <summary>
                    /// MAC address </summary>
                    member.write(buf, offset);
                    offset += member.@sizeof();

                    /// <summary>
                    /// Padding </summary>
                    buf.setValue16(offset, (short)0);
                    offset += 2;
                }

                fillNextPointersInLinkedList(buf, offset, matchingMemberSize);
            }

            return(0);
        }
示例#3
0
        public virtual int sceNetAdhocMatchingGetHelloOpt(int matchingId, TPointer32 optLenAddr, TPointer optData)
        {
            MatchingObject matchingObject = matchingObjects[matchingId];
            int            helloOptLen    = matchingObject.HelloOptLen;

            int bufSize = optLenAddr.getValue();

            optLenAddr.setValue(helloOptLen);

            if (helloOptLen > 0 && optData.Address != 0 && bufSize > 0)
            {
                int Length = System.Math.Min(bufSize, helloOptLen);
                writeBytes(optData.Address, Length, matchingObject.HelloOptData, 0);
            }

            return(0);
        }
示例#4
0
        public virtual void hleNetAdhocMatchingInputThread(Processor processor)
        {
            int matchingId = processor.cpu.getRegister(loopThreadRegisterArgument);

            if (log.TraceEnabled)
            {
                log.trace(string.Format("hleNetAdhocMatchingInputThread matchingId={0:D}", matchingId));
            }

            MatchingObject matchingObject = matchingObjects[matchingId];

            if (matchingObject != null && matchingObject.inputLoop())
            {
                Modules.ThreadManForUserModule.hleKernelDelayThread(10000, false);
            }
            else
            {
                // Exit thread with status 0
                processor.cpu._v0 = 0;
                Modules.ThreadManForUserModule.hleKernelExitDeleteThread();
            }
        }
示例#5
0
 public AdhocMatchingEventMessage(MatchingObject matchingObject, sbyte[] message, int Length) : base(message, Length)
 {
     this.matchingObject = matchingObject;
 }
示例#6
0
 public AdhocMatchingEventMessage(MatchingObject matchingObject, int @event, int address, int Length, sbyte[] toMacAddress) : base(address, Length, toMacAddress)
 {
     this.@event         = @event;
     this.matchingObject = matchingObject;
 }
示例#7
0
 public AdhocMatchingEventMessage(MatchingObject matchingObject, int @event) : base()
 {
     this.@event         = @event;
     this.matchingObject = matchingObject;
 }
示例#8
0
 public override AdhocMatchingEventMessage createAdhocMatchingEventMessage(MatchingObject matchingObject, sbyte[] message, int Length)
 {
     return(MatchingPacketFactory.createPacket(this, matchingObject, message, Length));
 }
示例#9
0
 public override AdhocMatchingEventMessage createAdhocMatchingEventMessage(MatchingObject matchingObject, int @event, int data, int dataLength, sbyte[] macAddress)
 {
     return(MatchingPacketFactory.createPacket(this, matchingObject, @event, data, dataLength, macAddress));
 }
示例#10
0
 public override AdhocMatchingEventMessage createAdhocMatchingEventMessage(MatchingObject matchingObject, int @event)
 {
     return(MatchingPacketFactory.createPacket(this, matchingObject, @event));
 }