示例#1
0
            public void ConnectToMachine(MachineBase m, EMU7800.Win.GameProgram g)
            {
                framebuffer  = m.CreateFrameBuffer();
                BufferWidth  = framebuffer.VisiblePitch;
                BufferHeight = framebuffer.Scanlines;
                vidbuffer    = new int[BufferWidth * BufferHeight];

                uint newsamplerate = (uint)m.SoundSampleFrequency;

                if (newsamplerate != samplerate)
                {
                    // really shouldn't happen (after init), but if it does, we're ready
                    if (resampler != null)
                    {
                        resampler.Dispose();
                    }
                    resampler  = new SpeexResampler(3, newsamplerate, 44100, newsamplerate, 44100, null, null);
                    samplerate = newsamplerate;
                    dcfilter   = DCFilter.DetatchedMode(256);
                }
                if (g.MachineType == MachineType.A7800PAL || g.MachineType == MachineType.A2600PAL)
                {
                    palette = TIATables.PALPalette;
                }
                else
                {
                    palette = TIATables.NTSCPalette;
                }
            }
示例#2
0
        public Atari7800(CoreComm comm, GameInfo game, byte[] rom, string GameDBfn)
        {
            ServiceProvider = new BasicServiceProvider(this);
            (ServiceProvider as BasicServiceProvider).Register<IVideoProvider>(avProvider);
            InputCallbacks = new InputCallbackSystem();
            CoreComm = comm;
            byte[] highscoreBIOS = comm.CoreFileProvider.GetFirmware("A78", "Bios_HSC", false, "Some functions may not work without the high score BIOS.");
            byte[] pal_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_PAL", false, "The game will not run if the correct region BIOS is not available.");
            byte[] ntsc_bios = comm.CoreFileProvider.GetFirmware("A78", "Bios_NTSC", false, "The game will not run if the correct region BIOS is not available.");

            if (EMU7800.Win.GameProgramLibrary.EMU7800DB == null)
            {
                EMU7800.Win.GameProgramLibrary.EMU7800DB = new EMU7800.Win.GameProgramLibrary(new StreamReader(GameDBfn));
            }

            if (rom.Length % 1024 == 128)
            {
                Console.WriteLine("Trimming 128 byte .a78 header...");
                byte[] newrom = new byte[rom.Length - 128];
                Buffer.BlockCopy(rom, 128, newrom, 0, newrom.Length);
                rom = newrom;
            }
            GameInfo = EMU7800.Win.GameProgramLibrary.EMU7800DB.TryRecognizeRom(rom);
            CoreComm.RomStatusDetails = GameInfo.ToString();
            Console.WriteLine("Rom Determiniation from 7800DB:");
            Console.WriteLine(GameInfo.ToString());

            this.rom = rom;
            this.game = game;
            this.hsbios = highscoreBIOS;
            this.bios = GameInfo.MachineType == MachineType.A7800PAL ? pal_bios : ntsc_bios;
            _pal = GameInfo.MachineType == MachineType.A7800PAL || GameInfo.MachineType == MachineType.A2600PAL;

            if (bios == null)
            {
                throw new MissingFirmwareException("The BIOS corresponding to the region of the game you loaded is required to run Atari 7800 games.");
            }

            HardReset();
        }