Exemple #1
0
 private void stopToolStripMenuItem_Click(object sender, EventArgs e)
 {
     isRunning = false;
     EmuState  = EmulationState.Stopped;
     c8CHIP8.Init();
     this.Text = "CHIP-8 Emulator";
 }
Exemple #2
0
 private void UpdateSpriteList(EmulationState state)
 {
     _spriteInfo = state.Sprites;
     _listView.BeginUpdate();
     _listView.VirtualListSize = state.Type == ProjectType.Snes ? 128 : 64;
     _listView.EndUpdate();
 }
Exemple #3
0
 public void UpdateStates(EmulationState state)
 {
     if (EmulationStateUpdate != null)
     {
         EmulationStateUpdate(state);
     }
 }
        public FormGameGenie(Emulator emulator)
        {
            this.emulator       = emulator;
            this.emulationState = this.emulator.emulationState;

            InitializeComponent();
            if (!emulationState.EmulationON)
            {
                MessageBox.Show(Program.ResourceManager.GetString("Message_NesIsOff"));
                Close();
                return;
            }
            gameGenie = new GameGenie();
            textBox2.SelectAll();
            //load list if found
            if (this.emulator.GameGenieCodes != null)
            {
                foreach (GameGenieCode code in this.emulator.GameGenieCodes)
                {
                    listView1.Items.Add(code.Name);
                    listView1.Items[listView1.Items.Count - 1].Checked = code.Enabled;
                    listView1.Items[listView1.Items.Count - 1].SubItems.Add(code.Descreption);
                }
            }
            checkBox1.Checked = this.emulator.IsGameGenieActive;
        }
        public GameInfoViewer(Emulator emulator)
        {
            this.emulator       = emulator;
            this.emulationState = this.emulator.emulationState;

            InitializeComponent();
            Clear();
        }
Exemple #6
0
 private void _loadRom()
 {
     c8CHIP8.Init();
     c8CHIP8.LoadRom(ofdOpenRomFileDialog.FileName);
     this.Text = "CHIP-8 Emulator - " + Path.GetFileName(ofdOpenRomFileDialog.FileName);
     isRunning = true;
     EmuState  = EmulationState.Running;
 }
Exemple #7
0
 void dbgWindow_onStart(object sender, EventArgs e)
 {
     if (EmuState == EmulationState.Paused)
     {
         isRunning = true;
         EmuState  = EmulationState.Running;
     }
     else if (EmuState == EmulationState.Running)
     {
         isRunning = false;
         EmuState  = EmulationState.Paused;
     }
 }
Exemple #8
0
        public DirectXVideo(Control surface_control, Emulator emulator)
        {
            this.surface_control = surface_control;
            this.emulator        = emulator;
            this.emulationState  = this.emulator.emulationState;

            // Make it not fullscreen
            fullScreen   = false;
            threadPAUSED = false;
            threadON     = true;
            // Make thread
            thread = new System.Threading.Thread(new ThreadStart(ClockThread));
            thread.Start();
        }
 public Emulation(IWorldMapProvider mapProvider,
                  IWorldMapFiller mapFiller,
                  IGenerationBuilder generationBuilder,
                  EmulationConfig config)
 {
     StatusMonitor                     = new StatusMonitor();
     state                             = new EmulationState();
     state.Changed                    += state => StateChanged?.Invoke(state);
     this.mapProvider                  = mapProvider;
     this.mapFiller                    = mapFiller;
     this.generationBuilder            = generationBuilder;
     Config                            = config;
     iterationsCountSinceLastItemSpawn = new Dictionary <WorldObjectType, int>
     {
         { WorldObjectType.Food, 0 },
         { WorldObjectType.Poison, 0 },
     };
 }
Exemple #10
0
 public void UpdateStates(EmulationState state)
 {
     if (state == null)
     {
         return;
     }
     _loading   = true;
     _lastState = state;
     if (state.Type == ProjectType.Nes)
     {
         UpdateNesState(state.NesState);
     }
     if (state.Type == ProjectType.Snes)
     {
         UpdateSnesState(state.SnesState);
     }
     _cpuMemory = state.Memory.CpuData;
     RefreshStack();
     _loading = false;
 }
        public static DisplayList Read(int segmentedPointer, EmulationState state, TextureManager texMan)
        {
            StringBuilder     log    = new StringBuilder();
            DisplayListReader reader = new DisplayListReader();

            reader.output = new DisplayList(texMan);
            int bank   = segmentedPointer >> 0x18;
            int offset = segmentedPointer & 0xFFFFFF;

            if (!state.AssertRead(segmentedPointer, 8))
            {
                return(null);
            }
            EmulationState.RAMBank b = state.banks[bank];
            reader.cursor    = segmentedPointer;
            reader.callStack = new Stack <int>();
            long currentCommand;

            do
            {
                b              = state.banks[reader.cursor >> 0x18];
                offset         = reader.cursor & 0xFFFFFF;
                currentCommand = ((long)cvt.uint32(b.value, offset) << 0x20) | (long)cvt.uint32(b.value, offset + 4);
                byte commandByte = b.value[offset];
                DisplayListCommand cmd;
                if (commands.TryGetValue(commandByte, out cmd))
                {
                    cmd(reader, currentCommand);
                }
                else
                {
                    log.Append("Skipped command " + Enum.GetName(typeof(GBI), commandByte) + " - " + currentCommand.ToString("X16") + "\n");
                }

                reader.cursor += 8;
            } while (!reader.terminated);

            System.Diagnostics.Debug.WriteLine(log.ToString());
            return(reader.output);
        }
Exemple #12
0
        public NesVSUnisystemDIPKeyboardConnection(IntPtr handle, IInputSettingsVSUnisystemDIP settings, EmulationState emulationState)
        {
            DirectInput di = new DirectInput();

            keyboard = new Keyboard(di);
            keyboard.SetCooperativeLevel(handle, CooperativeLevel.Nonexclusive | CooperativeLevel.Foreground);

            if (settings.CreditServiceButton != "")
            {
                CreditServiceButton = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditServiceButton);
            }
            if (settings.DIPSwitch1 != "")
            {
                DIPSwitch1 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch1);
            }
            if (settings.DIPSwitch2 != "")
            {
                DIPSwitch2 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch2);
            }
            if (settings.DIPSwitch3 != "")
            {
                DIPSwitch3 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch3);
            }
            if (settings.DIPSwitch4 != "")
            {
                DIPSwitch4 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch4);
            }
            if (settings.DIPSwitch5 != "")
            {
                DIPSwitch5 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch5);
            }
            if (settings.DIPSwitch6 != "")
            {
                DIPSwitch6 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch6);
            }
            if (settings.DIPSwitch7 != "")
            {
                DIPSwitch7 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch7);
            }
            if (settings.DIPSwitch8 != "")
            {
                DIPSwitch8 = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.DIPSwitch8);
            }
            if (settings.CreditLeftCoinSlot != "")
            {
                CreditLeftCoinSlot = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditLeftCoinSlot);
            }
            if (settings.CreditRightCoinSlot != "")
            {
                CreditRightCoinSlot = (SlimDX.DirectInput.Key)Enum.Parse(typeof(SlimDX.DirectInput.Key), settings.CreditRightCoinSlot);
            }
            emulationState.EMUShutdown += NesEmu_EMUShutdown;
        }
Exemple #13
0
        public NesVSUnisystemDIPJoystickConnection(IntPtr handle, string guid, IInputSettingsVSUnisystemDIP settings, EmulationState emulationState)
        {
            DirectInput di = new DirectInput();

            joystick = new Joystick(di, Guid.Parse(guid));
            joystick.SetCooperativeLevel(handle, CooperativeLevel.Nonexclusive | CooperativeLevel.Foreground);

            if (settings.CreditServiceButton != "")
            {
                CreditServiceButton = ParseKey(settings.CreditServiceButton);
            }
            if (settings.DIPSwitch1 != "")
            {
                DIPSwitch1 = ParseKey(settings.DIPSwitch1);
            }
            if (settings.DIPSwitch2 != "")
            {
                DIPSwitch2 = ParseKey(settings.DIPSwitch2);
            }
            if (settings.DIPSwitch3 != "")
            {
                DIPSwitch3 = ParseKey(settings.DIPSwitch3);
            }
            if (settings.DIPSwitch4 != "")
            {
                DIPSwitch4 = ParseKey(settings.DIPSwitch4);
            }
            if (settings.DIPSwitch5 != "")
            {
                DIPSwitch5 = ParseKey(settings.DIPSwitch5);
            }
            if (settings.DIPSwitch6 != "")
            {
                DIPSwitch6 = ParseKey(settings.DIPSwitch6);
            }
            if (settings.DIPSwitch7 != "")
            {
                DIPSwitch7 = ParseKey(settings.DIPSwitch7);
            }
            if (settings.DIPSwitch8 != "")
            {
                DIPSwitch8 = ParseKey(settings.DIPSwitch8);
            }
            if (settings.CreditLeftCoinSlot != "")
            {
                CreditLeftCoinSlot = ParseKey(settings.CreditLeftCoinSlot);
            }
            if (settings.CreditRightCoinSlot != "")
            {
                CreditRightCoinSlot = ParseKey(settings.CreditRightCoinSlot);
            }
            emulationState.EMUShutdown += NesEmu_EMUShutdown;
        }
Exemple #14
0
 private void startToolStripMenuItem_Click(object sender, EventArgs e)
 {
     isRunning = true;
     EmuState  = EmulationState.Running;
 }
Exemple #15
0
 private void pauseToolStripMenuItem_Click(object sender, EventArgs e)
 {
     isRunning = false;
     EmuState  = EmulationState.Paused;
 }
Exemple #16
0
 public TextureManager(EmulationState state, DeviceWrapper device)
 {
     this.device = device;
     this.state  = state;
 }