Exemple #1
0
        public static int SendMessage(QDVMthread thr)
        {
            CheckLowStack(thr.st, 3);
            int     addr  = thr.st.Pop();
            int     MsgID = thr.st.Pop();
            int     ThrID = thr.st.Pop();
            QDVMmsg msg   = new QDVMmsg();

            msg.ThrID = ThrID;
            msg.MsgID = MsgID;
            for (int i = 0; i < QDVMdef.MSG_DATA_SIZE; i++, addr++)
            {
                msg.Data[i] = thr.code[addr];
            }
            StkQDVM.Messages.Add(msg);
            return(0);
        }
Exemple #2
0
        public static int GetMessage(QDVMthread thr)
        {
            CheckLowStack(thr.st, 2);
            int     AddrData  = thr.st.Pop();
            int     AddrMsgID = thr.st.Pop();
            QDVMmsg msg       = StkQDVM.Messages.Find(delegate(QDVMmsg mess)
            {
                return(mess.ThrID == StkQDVM.ThrId);
            });

            if (msg == null)
            {
                return(0);
            }
            thr.code[AddrData] = (byte)msg.MsgID;
            for (int i = 0; i < QDVMdef.MSG_DATA_SIZE; i++, AddrMsgID++)
            {
                thr.code[AddrMsgID] = msg.Data[i];
            }
            return(1);
        }