コード例 #1
0
ファイル: Program.cs プロジェクト: lukehorak/Emux
        private static void Main(string[] args)
        {
            PrintAbout();
            (string romFile, string saveFile) = ParseArguments(args);
            var settings = ReadSettings();

            using (var host = new EmuxHost(settings))
                using (var mbc = new BufferedExternalMemory(saveFile))
                {
                    var cartridge = new EmulatedCartridge(File.ReadAllBytes(romFile), mbc);
                    var device    = new GameBoy.GameBoy(cartridge, host, true);
                    host.GameBoy = device;

                    device.Gpu.VideoOutput = host;

                    var mixer = new GameBoyNAudioMixer();
                    mixer.Connect(device.Spu);
                    var player = new DirectSoundOut();
                    player.Init(mixer);
                    player.Play();

                    host.Run();
                }
        }
コード例 #2
0
        public void PowerOn(string romName)
        {
            PoweredOn = true;

            bootstrapRom = new BootRom("../../../../DMG_BootRom.bin");
            rom          = new Rom(romName);
            //rom = new Rom("../../../../roms/games/tetris.gb");
            //rom = new Rom("../../../../roms/games/Dr. Mario.gb");
            //rom = new Rom("../../../../roms/games/Bubble Ghost (J).gb");
            //rom = new Rom("../../../../roms/games/Super Mario Land.gb");
            //rom = new Rom("../../../../roms/games/Super Mario Land 2 - 6 Golden Coins (UE) (V1.2).gb");
            //rom = new Rom("../../../../roms/games/Wario Land - Super Mario Land 3.gb");
            //rom = new Rom("../../../../roms/games/Bootleg Marioland 4.gb");
            //rom = new Rom("../../../../roms/games/Teenage Mutant Hero Turtles - Back from the Sewers (E).gb");
            //rom = new Rom("../../../../roms/games/Teenage Mutant Hero Turtles - Fall of the Foot Clan (E).gb");
            //rom = new Rom("../../../../roms/games/Teenage Mutant Hero Turtles III - Radical Rescue (E) [!].gb");
            //rom = new Rom("../../../../roms/games/Legend of Zelda, The - Link's Awakening (U) (V1.2).gb");
            //rom = new Rom("../../../../roms/games/Pokemon - Blue.gb");
            //rom = new Rom("../../../../roms/games/Gargoyle's Quest - Ghosts'n Goblins.gb");
            //rom = new Rom("../../../../roms/games/Mega Man V.gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong.gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong Land (U) [S][!].gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong Land 2 (UE) [S][!].gb");
            //rom = new Rom("../../../../roms/games/Donkey Kong Land III (U) [S][!].gb");
            //rom = new Rom("../../../../roms/games/X - Xekkusu.gb");
            //rom = new Rom("../../../../roms/games/Wave race.gb");
            //rom = new Rom("../../../../roms/games/F-1 Race.gb");
            //rom = new Rom("../../../../roms/games/Pinball Deluxe (U).gb");
            //rom = new Rom("../../../../roms/games/Prehistorik Man.gb");
            //rom = new Rom("../../../../roms/games/Amazing Spider-Man 3, The - Invasion of the Spider-Slayers (U) [!].gb");
            //rom = new Rom("../../../../roms/games/Tennis (JUE) [!].gb");

            //rom = new Rom("../../../../roms/bgbtest.gb");
            //rom = new Rom("../../../../roms/tellinglys.gb");                  //passes

            // Blargg CPU tests
            //rom = new Rom("../../../../roms/cpu_instrs.gb");
            //rom = new Rom("../../../../roms/01-special.gb");                  // passes
            //rom = new Rom("../../../../roms/02-interrupts.gb");               // passes
            //rom = new Rom("../../../../roms/03-op sp,hl.gb");                 // passes
            //rom = new Rom("../../../../roms/04-op r,imm.gb");                 // passes
            //rom = new Rom("../../../../roms/05-op rp.gb");                    // passes
            //rom = new Rom("../../../../roms/06-ld r,r.gb");                   // passes
            //rom = new Rom("../../../../roms/07-jr,jp,call,ret,rst.gb");       // passes
            //rom = new Rom("../../../../roms/08-misc instrs.gb");              // passes
            //rom = new Rom("../../../../roms/09-op r,r.gb");                   // passes
            //rom = new Rom("../../../../roms/10-bit ops.gb");                  // passes
            //rom = new Rom("../../../../roms/11-op a,(hl).gb");                // passes

            //rom = new Rom("../../../../roms/instr_timing.gb");                // passes
            //rom = new Rom("../../../../roms/mem_timing.gb");                  // passes
            //rom = new Rom("../../../../roms/mem_timing2.gb");                 // passes
            //rom = new Rom("../../../../roms/interrupt_time.gb");              // fails (GBC only)
            //rom = new Rom("../../../../roms/halt_bug.gb");

            // Mooneye tests
            //rom = new Rom("../../../../roms/bits_bank1.gb");                    // pass

            if (rom.Type == Rom.RomType.UnSupported)
            {
                throw new InvalidDataException("Unsupported ROM type");
            }

            interrupts = new Interrupts(this);
            ppu        = new Ppu(this);
            memory     = new Memory(this);
            cpu        = new Cpu(memory, interrupts, this);
            timer      = new DmgTimer(this);
            pad        = new Joypad(interrupts, this);
            spu        = new GameBoySpu(this);
            spu.Initialize();

            mixer = new GameBoyNAudioMixer();
            mixer.Connect(spu);
            player = new DirectSoundOut();
            player.Init(mixer);
            player.Play();

            cpu.Reset();
            ppu.Reset();
            interrupts.Reset();
            timer.Reset();
            pad.Reset();

            EmulatorTimer.Reset();
            EmulatorTimer.Start();

            if (rom.Type == Rom.RomType.MBC1_Ram_Battery)
            {
                rom.LoadMbc1BatteryBackData();
            }

            ticksPerSecond       = 0;
            secondsSinceLastSave = 0;
        }