コード例 #1
0
ファイル: EngineWrapper.cs プロジェクト: DESYS21/FyreVM
        private void vm_LineWanted(object sender, LineWantedEventArgs e)
        {
            if (wrapperState == VMWrapperState.RequestRestore)
            {
                entry = "restore";
            }

            if (wrapperState == VMWrapperState.RunCommand)
            {
                entry = saveCommand;
            }

            if (wrapperState == VMWrapperState.RequestSave)
            {
                entry = "save";
            }

            if (wrapperState == VMWrapperState.Completed)
            {
                entry = null;
            }

            needLine = false;
            e.Line   = entry;
        }
コード例 #2
0
 void engine_LineWanted(object sender, LineWantedEventArgs e)
 {
     if (test.CurrentStep.CommandType != CommandType.LineWanted)
     {
         test.CurrentStep.Status  = TestStatus.Failed;
         test.CurrentStep.Message = "Game requested unexpected line wanted.";
         engine.Stop();
     }
     else
     {
         e.Line = test.CurrentStep.Command;
     }
 }
コード例 #3
0
        void engine_LineWanted(object sender, LineWantedEventArgs e)
        {
            lineReady.Reset();

            if (WaitHandle.WaitAny(lineEvents) == 0)
            {
                e.Line = nextLine;
            }
            else
            {
                engine.Stop();
            }
        }
コード例 #4
0
        private uint glk_select(uint[] args)
        {
            DeliverOutput();

            if (glkWantLineInput)
            {
                string line;
                if (LineWanted == null)
                {
                    line = "";
                }
                else
                {
                    LineWantedEventArgs e = new LineWantedEventArgs();
                    LineWanted(this, e);
                    line = e.Line;
                }

                byte[] bytes = StringToLatin1(line);
                uint   max   = Math.Min(glkLineInputBufSize, (uint)bytes.Length);
                for (uint i = 0; i < max; i++)
                {
                    image.WriteByte(glkLineInputBuffer + i, bytes[i]);
                }

                // return event
                GlkWriteReference(
                    args[0],
                    GlkConst.evtype_LineInput, 1, max, 0);

                glkWantLineInput = false;
            }
            else if (glkWantCharInput)
            {
                char ch;
                if (KeyWanted == null)
                {
                    ch = '\0';
                }
                else
                {
                    KeyWantedEventArgs e = new KeyWantedEventArgs();
                    KeyWanted(this, e);
                    ch = e.Char;
                }

                // return event
                GlkWriteReference(
                    args[0],
                    GlkConst.evtype_CharInput, 1, ch, 0);

                glkWantCharInput = false;
            }
            else
            {
                // no event
                GlkWriteReference(
                    args[0],
                    GlkConst.evtype_None, 0, 0, 0);
            }

            return(0);
        }
コード例 #5
0
 private void vm_LineWanted(object sender, LineWantedEventArgs e)
 {
     this.Invoke(new Action(RequestLine));
     inputReadyEvent.WaitOne();
     e.Line = inputLine;
 }
コード例 #6
0
 public void FyreLineWanted(object sender, LineWantedEventArgs e)
 {
     e.Line = GetInputLineAsync().Result;
 }