Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the EmulatorHost class.
        /// </summary>
        /// <param name="virtualMachine">VirtualMachine instance to host.</param>
        /// <param name="instructionLog">Log which will be used to record instructions.</param>
        public EmulatorHost(VirtualMachine virtualMachine, InstructionLog instructionLog)
        {
            VirtualMachine = virtualMachine ?? throw new ArgumentNullException(nameof(virtualMachine));
            VirtualMachine.VideoModeChanged        += (s, e) => this.OnVideoModeChanged(e);
            VirtualMachine.MouseMoveByEmulator     += (s, e) => this.OnMouseMoveByEmulator(e);
            VirtualMachine.MouseMove               += (s, e) => this.OnMouseMove(e);
            VirtualMachine.MouseVisibilityChanged  += (s, e) => this.OnMouseVisibilityChanged(e);
            VirtualMachine.CursorVisibilityChanged += (s, e) => this.OnCursorVisibilityChanged(e);
            VirtualMachine.CurrentProcessChanged   += (s, e) => this.OnCurrentProcessChanged(e);

            this.log = instructionLog;
        }
Beispiel #2
0
        internal static void Emulate(VirtualMachine vm, InstructionLog log)
        {
            var info = FindOpcode(vm.PhysicalMemory, vm.Processor);

            if (!info.IsPrefix)
                log.Write(vm.Processor);

            var method = info.Emulators[vm.Processor.SizeModeIndex];
            if (method != null)
                method(vm);
            else
                throw GetPartiallyNotImplementedException(vm, info);
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the EmulatorHost class.
 /// </summary>
 /// <param name="instructionLog">Log which will be used to record instructions.</param>
 public EmulatorHost(InstructionLog instructionLog)
     : this(new VirtualMachine(), instructionLog)
 {
 }